techevan Posted June 19, 2008 Share Posted June 19, 2008 Hey there. I downloaded the contact form from css-tricks.com and uploaded it to my site after changing the PHP lines to my email address as said to do in the tutorial. I had Chris from the site itself help me with the form and it is working because it goes to the "Thank you" page although I am not getting any email from the form when I tested it myself in my inbox or in my spam folder-nothing. So please let me know if you can help me with this. You can view the php file at http://evaniscool.com/contactform/phptext.txt and the form at http://evaniscool.com/contactform/index.html Please let me know if you can help me and see why the form is not working. Thanks for your help and time! Quote Link to comment https://forums.phpfreaks.com/topic/110972-php-contact-form-help/ Share on other sites More sharing options...
timmah1 Posted June 19, 2008 Share Posted June 19, 2008 Why does phptext.txt show everything twice? It's showing everything below twice on the page phptext.txt <?php // CHANGE THE VARIABLES BELOW $EmailFrom = "MagicianEvan@gmail.com"; $EmailTo = "MagicianEvan@gmail.com"; $Subject = "Contact Form Submission"; $Name = Trim(stripslashes($_POST['Name'])); $Tel = Trim(stripslashes($_POST['Tel'])); $Email = Trim(stripslashes($_POST['Email'])); $Message = Trim(stripslashes($_POST['Message'])); // prepare email body text $Body = ""; $Body .= "Name: "; $Body .= $Name; $Body .= "\n"; $Body .= "Tel: "; $Body .= $Tel; $Body .= "\n"; $Body .= "Email: "; $Body .= $Email; $Body .= "\n"; $Body .= "Message: "; $Body .= $Message; $Body .= "\n"; // send email $success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>"); // redirect to success page // CHANGE THE URL BELOW TO YOUR "THANK YOU" PAGE if ($success){ print "<meta http-equiv=\"refresh\" content=\"0;URL=contactthanks.html\">"; } else{ print "<meta http-equiv=\"refresh\" content=\"0;URL=error.html\">"; } ?> Try deleting the second part and see if it works Quote Link to comment https://forums.phpfreaks.com/topic/110972-php-contact-form-help/#findComment-569353 Share on other sites More sharing options...
techevan Posted June 19, 2008 Author Share Posted June 19, 2008 Thanks for the quick reply but not sure why it showed up twice so I deleted the second part. It is updated but the form does still not send email to me. Thanks though! Still need help everyone with this! Help is very appreciated! Quote Link to comment https://forums.phpfreaks.com/topic/110972-php-contact-form-help/#findComment-569371 Share on other sites More sharing options...
Ironphp Posted June 19, 2008 Share Posted June 19, 2008 Thanks for the quick reply but not sure why it showed up twice so I deleted the second part. It is updated but the form does still not send email to me. Thanks though! Still need help everyone with this! Help is very appreciated! Hey techevan, I have tried your script and it works absolutely fine on my server. I had no problems. MagicianEvan@gmail.com to me show details 2:34 PM (0 minutes ago) Regards, Ironphp Quote Link to comment https://forums.phpfreaks.com/topic/110972-php-contact-form-help/#findComment-569434 Share on other sites More sharing options...
techevan Posted June 19, 2008 Author Share Posted June 19, 2008 I assume that means that you put the script on your server and tried it for me. I got a blank form submission email to my inbox so I need to figure out if this is my server's problem (freehostia hosts my site) or if it is because I am trying it on my home computer and it just wont send to my email. Any help ironphp or others? Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/110972-php-contact-form-help/#findComment-569600 Share on other sites More sharing options...
Ironphp Posted June 19, 2008 Share Posted June 19, 2008 I assume that means that you put the script on your server and tried it for me. I got a blank form submission email to my inbox so I need to figure out if this is my server's problem (freehostia hosts my site) or if it is because I am trying it on my home computer and it just wont send to my email. Any help ironphp or others? Thanks! Hey techevan, Would you also please post the code for your web form? Perhaps the POST variable of $Message isn't being sent correctly. Regards, Ironphp Quote Link to comment https://forums.phpfreaks.com/topic/110972-php-contact-form-help/#findComment-569603 Share on other sites More sharing options...
techevan Posted June 19, 2008 Author Share Posted June 19, 2008 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Contact Form</title> <link rel="stylesheet" type="text/css" href="style.css" /> <script type="text/javascript" src="js/jquery-1.2.6.min.js"></script> <script type="text/javascript" src="js/jquery.validate.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("#formLeft .input-bg").hover(function() { $(this).addClass("active"); }, function() { $(this).removeClass("active"); }); $("#formLeft input").focus(function() { $(this).parent().addClass("active"); }); $("#formLeft input").blur(function() { $("#formLeft .input-bg").removeClass("active"); }); $("#formRight .message-bg").hover(function() { $(this).addClass("active"); }, function() { $(this).removeClass("active"); }); $("#formRight textarea").focus(function() { $(this).parent().addClass("active"); }); $("#formRight textarea").blur(function() { $("#formRight .message-bg").removeClass("active"); }); $("#commentForm").validate(); }); </script> </head> <body> <div id="page-wrap"> <form method="post" action="contactengine.php" id="commentForm"> <fieldset> <div id="formLeft"> <label for="Name">Name:</label> <div class="input-bg"> <input type="text" name="Name" class="required" minlength="2" /> </div> <p><label for="Email">Email:</label> </p> <div class="input-bg"> <input type="text" name="Email" class="required email" /> </div> </div> <div id="formRight"> <label for="Message">Message:</label></td> <div class="message-bg"> <textarea name="Message" rows="20" cols="20" class="required"></textarea> </div> <br /> <input type="image" src="images/send-button.jpg" name="submit" value="Submit" class="submit-button" /> </div> <div class="clear"></div> </fieldset> </form> </div> <script src="http://www.google-analytics.com/urchin.js" type="text/javascript"> </script> <script type="text/javascript"> _uacct = "UA-68528-29"; urchinTracker(); </script> </body> </html> That is the code for the index.html page which has the form. This was taken directly from the tutorial at CSS-Tricks This is the code for the PHP file linked with it in case you need it still. <?php // CHANGE THE VARIABLES BELOW $EmailFrom = "magicianevan@gmail.com"; $EmailTo = "magicianevan@gmail.com"; $Subject = "Contact Form Submission"; $Name = Trim(stripslashes($_POST['Name'])); $Tel = Trim(stripslashes($_POST['Tel'])); $Email = Trim(stripslashes($_POST['Email'])); $Message = Trim(stripslashes($_POST['Message'])); // prepare email body text $Body = ""; $Body .= "Name: "; $Body .= $Name; $Body .= "\n"; $Body .= "Tel: "; $Body .= $Tel; $Body .= "\n"; $Body .= "Email: "; $Body .= $Email; $Body .= "\n"; $Body .= "Message: "; $Body .= $Message; $Body .= "\n"; // send email $success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>"); // redirect to success page // CHANGE THE URL BELOW TO YOUR "THANK YOU" PAGE if ($success){ print "<meta http-equiv=\"refresh\" content=\"0;URL=contactthanks.html\">"; } else{ print "<meta http-equiv=\"refresh\" content=\"0;URL=error.html\">"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/110972-php-contact-form-help/#findComment-569621 Share on other sites More sharing options...
Ironphp Posted June 19, 2008 Share Posted June 19, 2008 Dear techevan, As my prior findings have found, I believe the script itself is working correctly. I posted both the webform and the mail function in my own website, and it worked fine. If you aren't receiving any email at all: Have you tried making a new php page to see if the mail function works at all? <?php mail('youremail', 'My Subject', "Test!"); ?> If you have trouble using the mail() in a simple script, perhaps it's a server configuration. If you are receiving a blank form submission in your email, perhaps try print_r($_POST) die("..."); and review that the POST variables are being sent correctly. They were when I tried them, but this may be a nasty server thing. I hope you figure out your issue, Regards, Ironphp Quote Link to comment https://forums.phpfreaks.com/topic/110972-php-contact-form-help/#findComment-569627 Share on other sites More sharing options...
techevan Posted June 19, 2008 Author Share Posted June 19, 2008 Sorry but do I just upload that new php file and try it on my server or do I link it to a new contact form? Sorry for asking this. I am thinking that this is my server but still need a little more help with this. Thanks alot! Quote Link to comment https://forums.phpfreaks.com/topic/110972-php-contact-form-help/#findComment-569636 Share on other sites More sharing options...
Ironphp Posted June 19, 2008 Share Posted June 19, 2008 Sorry but do I just upload that new php file and try it on my server or do I link it to a new contact form? Sorry for asking this. I am thinking that this is my server but still need a little more help with this. Thanks alot! You just upload it and run it on the server. Additionally, when you were testing to see if your initial script was running, you initiating the script by typing information into the form, rather than just typing the address of the process page, right? Quote Link to comment https://forums.phpfreaks.com/topic/110972-php-contact-form-help/#findComment-569644 Share on other sites More sharing options...
techevan Posted June 19, 2008 Author Share Posted June 19, 2008 Right I was putting actual information in the fields but it is still not working. Right now, I am assuming it has to be my hosting freehostia. I am sure that it what it is because this thing is just not working. Quote Link to comment https://forums.phpfreaks.com/topic/110972-php-contact-form-help/#findComment-569650 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.