Jump to content

[SOLVED] PHP Form Mail Problem


geebo

Recommended Posts

When I click send on my form, I get an email with all the headings but no content. None of the text I enter on the form or the drop-down selection makes it to the email. So I get an email that looks like:

 

Name:

 

Email:

 

Area of Interest:

 

Comments:

 

I'm sure it's a minor omission on my part (as usual). Do I need to name the form in the script? That isn't anywhere in the book I'm using. Form is at http://www.sons-of-liberty-sar.org/_contact.php. Thanks!!

 

Form script and php script below:

 

<form id="contactform" name="contactform" method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>">
   <p class="contactform">
     <label for="name">Name</label>
     <input name="name" type="text" class="NewSOL" id="#contactform" style="input" />
   </p>
   <p class="contactform">
     <label for="email" class="NewSOL" id="contactform" style="textInput">Email</label>
     <input name="email" type="text" class="NewSOL" id="#contactform" style="input" />
     </p>
     <p>
     <label for="area">Area (Select One)</label>
     <select name="area" id="area">
       <option>General Comments or Questions</option>
       <option>Web Site</option>
       <option>Genealogy Help</option>
       <option>Membership Questions</option>
       <option>Newsletter</option>
       <option>Commander-in-Chief Guards</option>
     </select>
   </p>
    <label for="comments" class="NewSOL" id="contactform" style="textarea">Comments</label>
    <p>
 <textarea name="comments" cols="" rows="" class="NewSOL" id="#contactform" style="textarea"></textarea>   
 </p>
    <p>
      <input name="submit" type="submit" class="NewSOL" id="contactform" style="submit width: 100px; width: 100px;" value="Send" />
</p>
 </form>

<?php 
if (array_key_exists('submit', $_POST)) {
$to = '[email protected]';
$subject = 'Inquiry from Sons of Liberty Website';
$name = $POST['name'];
$email = $POST['email'];
$area = $POST['area'];
$comments = $POST['comments'];
$message = "Name: $name\n\n";
$message .= "Email: $email\n\n";
$message .= "Area of Interest: $area\n\n";
$message .= "Comments: $comments\n\n";
$message = wordwrap($message, 70);
$mailSent = mail($to, $subject, $message);
}
?>

Link to comment
https://forums.phpfreaks.com/topic/120425-solved-php-form-mail-problem/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.