Need help with an email submit for please

Discussion in 'HTML & Website Design' started by Dave Hybrid, Apr 30, 2008.

  1. #1
    This for was working but for some reason it has stopped.

    This is the code on my website:

    <form method="POST" action="mail.php">
       Your Name: <br />
       <input type="text" name="name" size="45"><br>
       <br>
       Your Email: <br />
        <input type="text" name="email" size="45"><br>
       <br>
       Your Message: <br />   
       <textarea rows="5" name="message" cols="36"></textarea>
       <img src="http://www.hybrid-computers.biz/phone.gif" alt="Phone" width="158" height="100" hspace="17" align="top" /><img src="http://www.hybrid-computers.biz/email.gif" alt="Email" width="100" height="90" align="top" /><br>
       <input type="submit" value="Submit" name="submit">
    </form>
    Code (markup):
    And this is the code in mail.php:

    <?php
    if(isset($_POST['submit'])) {
    
    $to = "mail@computer-juice.com";
    $subject = "Enquiry - Hybrid Computers";
    $name_field = $_POST['name'];
    $email_field = $_POST['email'];
    $message = $_POST['message'];
     
    $body = "Name: $name_field
    Email: $email_field
    Message: $message";
     
    echo "Thank you for contacting us.";
    mail($to, $subject, $body);
    
    } else {
    
    echo "blarg!";
    
    }
    ?>
    Code (markup):
    Any help appriciated.
     
    Dave Hybrid, Apr 30, 2008 IP
  2. nicangeli

    nicangeli Peon

    Messages:
    828
    Likes Received:
    23
    Best Answers:
    0
    Trophy Points:
    0
    #2
    What does happen then?

    What errors do you get?
     
    nicangeli, Apr 30, 2008 IP
  3. awatson

    awatson Active Member

    Messages:
    112
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    53
    #3
    If it seems to be working but you're not getting the email, you can check your mail server logs to see if it's being sent/received.
     
    awatson, Apr 30, 2008 IP