Colleen78 Posted September 11, 2006 Share Posted September 11, 2006 I am wondering if anyone can see why this doesn't work, when you use it, nothing happens.[code]<?require_once("conn.php");include_once "templates/MainHeader.php";if(isset($submit)){ if(!empty($_POST[name])) { $name1 = strip_tags($_POST[name]); } else { echo "<p align=\"center\"><font size=\"2\" face=\"Arial, Helvetica, sans-serif\">You did not enter your name.</p>"; } if(!empty($_POST[email])) { $email1 = strip_tags($_POST[email]); } else { echo "<p align=\"center\"><font size=\"2\" face=\"Arial, Helvetica, sans-serif\">You did not enter your email address.</p>"; } if(!empty($_POST[subject])) { $subject1 = strip_tags($_POST[subject]); } else { echo "<p align=\"center\"><font size=\"2\" face=\"Arial, Helvetica, sans-serif\">The subject field is empty.</p>"; } if(!empty($_POST[message])) { $message1 = strip_tags($_POST[message]); } else { echo "<p align=\"center\"><font size=\"2\" face=\"Arial, Helvetica, sans-serif\"> You did not write a message.</p>"; } if(!empty($name1) && !empty($email1) && !empty($subject1) && !empty($message1)) { //I use the email for official corespondence $to = "$_SERVER[HTTP_HOST] <$aset[ContactEmail]>"; //display the message author and his email $from = "From: $name1 <$email1>"; //this subject will be visible only for you $sub = "Contact form message - JokeMadness"; //fit together all the post information into one message $message = "$subject1 \n\n"."$message1 \n\n"."$name1\n"; //if a user has insert some html/javascript/php tags //we will remove them for security reasons $message = stripslashes($message); //now send the message mail($to, $sub, $message, $from); //display "thank you" message. You can edit it and write what you want. //if you want to use quotes at this message, use this format: \"text here\" //you can use any html tags echo "<p align=\"center\"><font size=\"2\" face=\"Arial, Helvetica, sans-serif\"><br />Thanks for your message. <br />We will contact you as soon as possible.</p>"; include_once ("templates/MainFooter.php"); exit(); } }?><br /><form method="post" action=""><fieldset><legend>Contact Us</legend><table border="0" cellspacing="2" cellpadding="5"> <tr> <td colspan="2"><b>Note:</b> all fields are required.<br /></td> </tr> <tr> <td>Your name:</td> <td> <input type="text" name="name" /></td> </tr> <tr> <td>Your email:</td> <td> <input type="text" name="email" /></td> </tr> <tr> <td>Subject:</td> <td> <input type="text" name="subject" /></td> </tr> <tr> <td valign="top">Message:</td> <td> <textarea name="message" rows="4" cols="30"></textarea></td> </tr> <tr> <td colspan="2" align="center"><input type="submit" name="submit" class="SRT" value="Send" /> <input type="reset" class="SRT" /></td> </tr></table></fieldset></form><?php include_once ("templates/MainFooter.php"); ?>[/code]If you can help me pinpoint the problem, excellent! I've been trying to figure it out for days. There's no errors, nothing. I've even removed the includes to see what happens and it still doesn't work so it's not the templates either. Link to comment https://forums.phpfreaks.com/topic/20354-contact-form-doesnt-work-came-with-script/ Share on other sites More sharing options...
kayess2004 Posted September 11, 2006 Share Posted September 11, 2006 Hi,try changing the following :[code]if(isset($submit)){[/code]to[code]if(isset($_POST['submit'])){[/code]See how you go.HTH Link to comment https://forums.phpfreaks.com/topic/20354-contact-form-doesnt-work-came-with-script/#findComment-89662 Share on other sites More sharing options...
Colleen78 Posted September 11, 2006 Author Share Posted September 11, 2006 That did the trick! Thanks so much! I wish I'd seen that. :D Link to comment https://forums.phpfreaks.com/topic/20354-contact-form-doesnt-work-came-with-script/#findComment-90047 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.