geebo Posted August 19, 2008 Share Posted August 19, 2008 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 More sharing options...
utdfederation Posted August 19, 2008 Share Posted August 19, 2008 i would suggest you put your code into the tag form so people can read it correctly or from what i have read they will not answer your post. from what i have read this is one of the forum rules. just thought i'd let you know this. Link to comment https://forums.phpfreaks.com/topic/120425-solved-php-form-mail-problem/#findComment-620521 Share on other sites More sharing options...
geebo Posted August 19, 2008 Author Share Posted August 19, 2008 I can't edit the post. sorry. Link to comment https://forums.phpfreaks.com/topic/120425-solved-php-form-mail-problem/#findComment-620534 Share on other sites More sharing options...
akitchin Posted August 19, 2008 Share Posted August 19, 2008 you're missing underscores between $ and POST. Link to comment https://forums.phpfreaks.com/topic/120425-solved-php-form-mail-problem/#findComment-620544 Share on other sites More sharing options...
geebo Posted August 19, 2008 Author Share Posted August 19, 2008 you're missing underscores between $ and POST. DOOOH! THANK YOU akitchin!! Why can I stare at a stupid mistake like that for hours and not see it?? Link to comment https://forums.phpfreaks.com/topic/120425-solved-php-form-mail-problem/#findComment-620551 Share on other sites More sharing options...
akitchin Posted August 19, 2008 Share Posted August 19, 2008 the most obvious errors are the most obscure when one has been poring over their code for any longer than a few minutes. Link to comment https://forums.phpfreaks.com/topic/120425-solved-php-form-mail-problem/#findComment-620552 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.