SitePoint Sponsor

User Tag List

Results 1 to 8 of 8

Thread: Contact US

  1. #1
    SitePoint Enthusiast devAngel's Avatar
    Join Date
    Sep 2005
    Posts
    68
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Contact US

    Please please help me...I'm very new to PHP and I'm trying to have a contact us page. I tried downloading a free script but couldn't understand a thing. I just have this code:

    Code:
    <?
    
    foreach($_GET as $key => $value)
    
    {
    
        $$key = $value;
    
    }
    
    foreach($_POST as $key => $value)
    
    {
    
        $$key = $value;
    
    }
    
    $page_title="";
    
    $page_description="";
    
    $page_keywords="";
    
    
    
    if (!isset($btn_contact)):
    
    		header ("location:index.html");
    
    else:
    
    		$mailto="";
    
    		$subject="";
    
    		$message=implode('',file('index.html'));
    
    		$message=str_replace('"',"&quote;",$message);
    
    		eval("\$message=\"$message\";");
    
    		$message=str_replace('&quote;','"',$message);
    
    		$header="From: $email\n";
    
    		@mail($mailto,$subject,$message,$header);
    
    		header ("location:index.html");
    
    	
    
    endif;
    
    
    
    ?>

    Can somebody please please guide me how do I use this? and where should I put it?

    uber newbie
    sig space open...

  2. #2
    SitePoint Evangelist optl's Avatar
    Join Date
    Oct 2004
    Location
    Washington DC
    Posts
    415
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Take off the @ sign before mail so you can see any error messages to start.
    For the phrase "Bethesda home architect", my clients
    websites occupy 6 of the first 8 results
    on the 1st page of Google. My Secret SEO Strategy Revealed

  3. #3
    SitePoint Enthusiast devAngel's Avatar
    Join Date
    Sep 2005
    Posts
    68
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by optl View Post
    Take off the @ sign before mail so you can see any error messages to start.
    thanks for that. I got another mailer.php that I quite understand however, I cant make it work there seems to be no error on the mailer.php

    PHP Code:
     <?php
    if(isset($_POST['submit'])) {
    $to "email@email.com";
    $subject "message here";
    $name_field $_POST['name'];
    $company_field $_POST['company'];
    $phone_field $_POST['phone'];
    $email_field $_POST['email'];
    $message $_POST['message']; 



    $body "From: $name_field\n Company: $company_field\n Phone: $phone_field\n E-Mail: $email_field\n Comments:\n $message";

    echo 
    "Thank you for submitting our form. We will get back to you as soon as possible.";
    mail($to$subject$body);

    } else {

    echo 
    "Pls. Try Again.";
    }
    ?>

    When I click on the Submit button, it directs me to a 405 error
    sig space open...

  4. #4
    SitePoint Evangelist rhysboy84's Avatar
    Join Date
    May 2007
    Location
    Colwyn Bay, North Wales, UK
    Posts
    438
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quick question, have you checked that PHP definitely works on your server?

    something like <?php echo "Hello World"; ?> in a file called helloworld.php would do the trick.

    Does that bring up an error?
    I'm Rhys Wynne & I blog at Winwar Media
    WP Email Capture: Free Email/Ebook Marketing Wordpress Plugin
    UK Based SEO? Tweet Your Location to #ukseohere!
    | My Brand New Brand | Twitter |

  5. #5
    SitePoint Enthusiast devAngel's Avatar
    Join Date
    Sep 2005
    Posts
    68
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by rhysboy84 View Post
    Quick question, have you checked that PHP definitely works on your server?

    something like <?php echo "Hello World"; ?> in a file called helloworld.php would do the trick.

    Does that bring up an error?
    it downloaded the php file...i guess that's my answer

    thank you guys
    sig space open...

  6. #6
    Follow: @AlexDawsonUK silver trophybronze trophy AlexDawson's Avatar
    Join Date
    Feb 2009
    Location
    England, UK
    Posts
    8,111
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    devAngel, is your host on a Windows server? Because most hosts support php in some form as it is the predominant server-side language in use currently, it just seems rather supprising that theres a host which doesn't like php (especially with host competition like it is)!

  7. #7
    SitePoint Evangelist rhysboy84's Avatar
    Join Date
    May 2007
    Location
    Colwyn Bay, North Wales, UK
    Posts
    438
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by AlexDawson View Post
    devAngel, is your host on a Windows server? Because most hosts support php in some form as it is the predominant server-side language in use currently, it just seems rather supprising that theres a host which doesn't like php (especially with host competition like it is)!
    The error is commonly associated with windows servers, so my guess would be yes.
    I'm Rhys Wynne & I blog at Winwar Media
    WP Email Capture: Free Email/Ebook Marketing Wordpress Plugin
    UK Based SEO? Tweet Your Location to #ukseohere!
    | My Brand New Brand | Twitter |

  8. #8
    SitePoint Enthusiast devAngel's Avatar
    Join Date
    Sep 2005
    Posts
    68
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by AlexDawson View Post
    devAngel, is your host on a Windows server? Because most hosts support php in some form as it is the predominant server-side language in use currently, it just seems rather supprising that theres a host which doesn't like php (especially with host competition like it is)!
    I guess so...


    anyways, thanks guys for responding
    sig space open...


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •