www.webdeveloper.com
Results 1 to 9 of 9

Thread: Contact form

Hybrid View

  1. #1
    Join Date
    Jun 2012
    Posts
    5

    Contact form

    So, my website is up but my contact form is not working, tomswenson.ca

    <?php

    $subject ="Contact Form";

    $info="$info";

    $mail_from="$email";

    $header="from: $name <$email>";

    $to ='myemail';
    $send_contact=mail($to,$subject,$info,$header);

    if($send_contact){
    echo "We've recived your contact information";
    }
    else {
    echo "ERROR";
    }
    ?>

    Any help? ANNNNND, is there anyway to put the subject the radio buttons?

  2. #2
    Join Date
    May 2012
    Posts
    42
    "It's not working" is pretty vague. Are you getting any errors? Is the page echoing "ERROR"? Does everything "seem" to work, only you never receive the email? What do you get if you put var_dump($to, $subject, $info, $header); on the line right above mail()?
    Keith

    Freelance PHP Web Developer
    http://www.duvalltech.com/

  3. #3
    Join Date
    Jun 2012
    Posts
    5
    It doesn't echo anything and It doesn't send me the message.

  4. #4
    Join Date
    May 2012
    Posts
    42
    Try this, replacing the value of $to with your actual email address:
    PHP Code:
    <?php

    $subject 
    ="Contact Form"

    $info="Test Info Value";

    $mail_from="nobody@nowhere.com"

    $headers "From: {$mail_from}\r\n" .
        
    "Reply-To: {$mail_from}\r\n" .
        
    'X-Mailer: PHP/' phpversion();

    $to ='myemail';

    if (!
    mail($to$subject$info$headers)) {
        echo 
    "There was an error.";
    } else {
        echo 
    "Your message was sent.";
    }

    ?>
    Keith

    Freelance PHP Web Developer
    http://www.duvalltech.com/

  5. #5
    Join Date
    Jun 2012
    Posts
    5
    Still doesn't quite work. Still no echos or any sort of email.

  6. #6
    Join Date
    Jun 2012
    Posts
    5
    Haha, funny story, all that was missing, very start of the form tag, the action script was blank. It wasn't pointing to the contact.php folder! But now, onto the PHP file, how do I get my radio buttons in the email?

  7. #7
    Join Date
    May 2012
    Posts
    42
    PHP Code:
    $subject $_POST['radiobuttonfield']; 
    Keith

    Freelance PHP Web Developer
    http://www.duvalltech.com/

  8. #8
    Join Date
    Jun 2012
    Posts
    5
    All right! All finished and done! Thank you very much for your help!

  9. #9
    Join Date
    May 2012
    Posts
    42
    No problem.
    Keith

    Freelance PHP Web Developer
    http://www.duvalltech.com/

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles