abediesel Posted August 25, 2009 Share Posted August 25, 2009 i cant get my php form to work im a n00b when it comes to this stuff im just trying to help a family friend with their website the site is "http://www.myninelives.com/contact_us.html" the php file is "http://www.myninelives.com/angi_contactus.php" the code is as shown: html for contact us: "<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>MY NINE LIVES</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body bgcolor="#000000" text="#FFFFFF" link="#FF9900" vlink="#FF9900" alink="#FF9900"><td colspan="20"> <center> <form action="angi_contactus.php" method="get" enctype="application/x-www-form-urlencoded" name="interest" id="interest"> <table width="600" border="0" cellpadding="5"> <tr> <td width="284"><input name="imageField" type="image" src="file:///Dreamweaver%20MX%20TFS/DWMX_project/Lesson_11_Forms/Images/spacer.gif" width="110" height="1" border="0"></td> <td width="2"><input name="imageField2" type="image" src="file:///Dreamweaver%20MX%20TFS/DWMX_project/Lesson_11_Forms/Images/spacer.gif" width="1" height="1" border="0"></td> <td width="463"><input name="imageField3" type="image" src="file:///Dreamweaver%20MX%20TFS/DWMX_project/Lesson_11_Forms/Images/spacer.gif" width="463" height="1" border="0"></td> </tr> <tr> <td colspan="3"><div align="center"><font face="Arial" color=#666666 size=2><B></B></font></div> <div align="left"><img src="head.jpg" width="1024" height="200"> </div></td> </tr> <tr> <td colspan="3"><div align="left"> <p>$18.95 plus $3.00 S&H</p> <p>Make checks or money orders payable to: </p> <p>Roy Sannella<br> 26310 Rampart Blvd #A<br> Punta Gorda, FL 33983</p> <p><font color="#FFFFFF">Books also available at <a href="http://www.iuniverse.com/bookstore/book_detail.asp?isbn=0-595-33675-2">iUniverse.com</a>, <a href="http://www.booksamillion.com/ncom/books?id=4027687927282&isbn=0595336752">Booksamillion.com</a>, <a href="http://www.amazon.com/My-Nine-Lives-This-Life/dp/0595336752/ref=sr_1_9?ie=UTF8&s=books&qid=1202769007&sr=8-9">Amazon.com</a> and <a href="http://search.barnesandnoble.com/booksearch/isbnInquiry.asp?z=y&EAN=9780595336753&itm=4">Barnes & Nobel.com</a></font></p> <p>To arrange an author interview, please call 941-624-6047 or e-mail<br> Marnav14@earthlink.net</p> </div> </td> </tr> <tr> <td colspan="3"><div align="left"><font color="#FFFFFF" size=2 face="Tahoma, Geneva, Verdana, Arial">To get your copy the easy way fill out the form below.<br> Return it to us to receive a handsome autographed book.</font></div> <div align="left"> </div></td> </tr> <tr> <td colspan="3"><div align="left"><font color="#FFFFFF" size="2" face="Tahoma, Geneva, Verdana, Arial"><strong>Information</strong></font></div> <div align="left"> </div></td> </tr> <tr> <td width="284"><div align="left"><font color="#FFFFFF" size="2" face="Tahoma, Geneva, Verdana, Arial">Name:</font></div></td> <td width="2"><font color="#666666" size="2" face="Tahoma, Geneva, Verdana, Arial"> </font></td> <td width="463"><div align="left"> <font color="#666666" size="2" face="Tahoma, Geneva, Verdana, Arial"> <input name="name" type="text" id="name" size="40" maxlength="50"> </font></div></td> </tr> <tr> <td width="284"><div align="left"><font color="#FFFFFF" size="2" face="Tahoma, Geneva, Verdana, Arial">E-mail:</font></div></td> <td width="2"><font color="#666666" size="2" face="Tahoma, Geneva, Verdana, Arial"> </font></td> <td width="463"><div align="left"> <font color="#666666" size="2" face="Tahoma, Geneva, Verdana, Arial"> <input name="email" type="text" id="email" onBlur="MM_validateForm('name','','R','email','','RisEmail');return document.MM_returnValue" value="enter your e-mail address" size="40" maxlength="70"> </font></div></td> </tr> <td width="284"><div align="left"><font color="#FFFFFF" size="2" face="Tahoma, Geneva, Verdana, Arial">Tel.:</font></div></td> <td width="2"><font color="#666666" size="2" face="Tahoma, Geneva, Verdana, Arial"> </font></td> <td width="463"><div align="left"> <font color="#666666" size="2" face="Tahoma, Geneva, Verdana, Arial"> <input name="tel" type="text" id="tel" size="16" maxlength="15"> </font></div></td> </tr> <td colspan="3"><div align="left"><font face="Tahoma, Geneva, Verdana, Arial"><font face="Tahoma, Geneva, Verdana, Arial"><font color="#666666"><font size="2"><font size="2"><font color="#666666"></font></font></font></font></font></font></div></td> </tr> <tr> <td colspan="3"><div align="left"></div> <div align="left"> </div></td> </tr> <tr> <td width="284" valign="top"><div align="left"><font color="#FFFFFF" size="2" face="Tahoma, Geneva, Verdana, Arial">Questions/What message or name would you like on the autograph page?:</font></div></td> <td width="2"><font color="#666666" size="2" face="Tahoma, Geneva, Verdana, Arial"> </font></td> <td width="463"><div align="left"> <font color="#666666" size="2" face="Tahoma, Geneva, Verdana, Arial"> <textarea name="question" cols="50" rows="5" id="question"></textarea> </font></div></td> </tr> <tr> <td colspan="3"><p><font color="#666666" size="2" face="Tahoma, Geneva, Verdana, Arial"><strong><font color="#FFFFFF">Submit Form </font></strong><br> </font></p></td> </tr> <tr> <td width="284"><div align="right"> <font size="2" face="Tahoma, Geneva, Verdana, Arial"> <input name="reset" type="reset" id="reset" value="Clear Form"> </font></div></td> <td width="2"><font size="2" face="Tahoma, Geneva, Verdana, Arial"> </font></td> <td width="463"><div align="left"> <font size="2" face="Tahoma, Geneva, Verdana, Arial"> <input name="Submit" type="submit" id="Submit" onClick="MM_validateForm('name','email','R');MM_validateForm('name','','R','email','','RisEmail');return document.MM_returnValue" value="Submit"> </font></div></td> </tr> <tr> <td colspan="3"><div align="right"></div> <div align="left"></div></td> </tr> <tr> <td colspan="3"><div align="right"> </div> <div align="left"> </div></td> </tr> </table> </form> </center></td> </body> </html> and the php file code is: <?php $name = $_POST['name'] ; $email = $_POST['email'] ; $tel = $_POST['tel'] ; $question = $_POST['question'] ; $sent = mail( "Marnav14@earthlink.net", 'Contact Us Form', "Name: $name\r\n email: $email\r\n Tel: $tel\r\n question: $question"); header( "Location: http://www.myninelives.com/thank.html" ); ?> i really really need help with this tonight and will paypal 5 dollars to anyone who can assist me as to why this wont work once again im a n00b, plz dont flame Quote Link to comment https://forums.phpfreaks.com/topic/171850-i-cant-get-my-php-form-to-send-email/ Share on other sites More sharing options...
ignace Posted August 25, 2009 Share Posted August 25, 2009 <td width="284"><input name="imageField" type="image" src="file:///Dreamweaver%20MX%20TFS/DWMX_project/Lesson_11_Forms/Images/spacer.gif" width="110" height="1" border="0"></td> <td width="2"><input name="imageField2" type="image" src="file:///Dreamweaver%20MX%20TFS/DWMX_project/Lesson_11_Forms/Images/spacer.gif" width="1" height="1" border="0"></td> <td width="463"><input name="imageField3" type="image" src="file:///Dreamweaver%20MX%20TFS/DWMX_project/Lesson_11_Forms/Images/spacer.gif" width="463" height="1" border="0"></td> should be: <td width="284"><input name="imageField" type="image" src="Images/spacer.gif" width="110" height="1" border="0"></td> <td width="2"><input name="imageField2" type="image" src="Images/spacer.gif" width="1" height="1" border="0"></td> <td width="463"><input name="imageField3" type="image" src="Images/spacer.gif" width="463" height="1" border="0"></td> Don't forget to upload the Images directory and make sure this html file is in the same directory as the images directory Second you need to define a From: header otherwise your e-mail will end up as SPAM $phpversion = phpversion(); if (mail( "Marnav14@earthlink.net", 'Contact Us Form', "Name: $name\r\n email: $email\r\n Tel: $tel\r\n question: $question", "From: $name <$email>\r\nReply-To: $name <$email>\r\nX-Mailer: PHP/$phpversion")) { header( "Location: http://www.myninelives.com/thank.html" ); } Quote Link to comment https://forums.phpfreaks.com/topic/171850-i-cant-get-my-php-form-to-send-email/#findComment-906135 Share on other sites More sharing options...
mikesta707 Posted August 25, 2009 Share Posted August 25, 2009 BTW there is a hire a coder forum if your willing to pay money, but 5 dollars is a pretty lolzy amount. Given your problem though, it shouldn't be that hard to figure out. the problem is your form's action is set to get, and your variables try to get the data via post. you have two extremely easy options. Either change the following line in your form <form action="angi_contactus.php" method="get" enctype="application/x-www-form-urlencoded" name="interest" id="interest"> to <form action="angi_contactus.php" method="post" enctype="application/x-www-form-urlencoded" name="interest" id="interest"> OR change your php from $name = $_POST['name'] ; $email = $_POST['email'] ; $tel = $_POST['tel'] ; $question = $_POST['question'] ; to $name = $_GET['name'] ; $email = $_GET['email'] ; $tel = $_GET['tel'] ; $question = $_GET['question'] ; Quote Link to comment https://forums.phpfreaks.com/topic/171850-i-cant-get-my-php-form-to-send-email/#findComment-906143 Share on other sites More sharing options...
abediesel Posted August 25, 2009 Author Share Posted August 25, 2009 yea i actually made that problem for myself, soemoen else did this website and code i just need to figure out why the form isnt getting sent i made the changes you both suggestedd but the form still isnt coming to my email Quote Link to comment https://forums.phpfreaks.com/topic/171850-i-cant-get-my-php-form-to-send-email/#findComment-906152 Share on other sites More sharing options...
mikesta707 Posted August 25, 2009 Share Posted August 25, 2009 Does your server have an SMTP mail server installed. make a page and write phpinfo(); and check to see if SMTP is configured on the server Quote Link to comment https://forums.phpfreaks.com/topic/171850-i-cant-get-my-php-form-to-send-email/#findComment-906156 Share on other sites More sharing options...
abediesel Posted August 25, 2009 Author Share Posted August 25, 2009 yea its got an smtp server, im usin globat if that helps at all, this is really frustrating, id rather just remake the page in dreamweaver seeing as how i didnt do the original code, any help with that, i mean 5 dollars is cheap ill pay 15-20 if someone can serioulsy solve this for me, i kno its sumthin simple i just dont do webdesign mostly graphics Quote Link to comment https://forums.phpfreaks.com/topic/171850-i-cant-get-my-php-form-to-send-email/#findComment-906209 Share on other sites More sharing options...
ignace Posted August 26, 2009 Share Posted August 26, 2009 Make sure you have form method="post" then use this code: if (!empty($_POST)) { $name = $_POST['name']; $email = $_POST['email']; $tel = $_POST['tel']; $question = $_POST['question']; $phpversion = phpversion(); if (mail( "Marnav14@earthlink.net", 'Contact Us Form', "Name: $name\r\n email: $email\r\n Tel: $tel\r\n question: $question", "From: $name <$email>\r\nReply-To: $name <$email>\r\nX-Mailer: PHP/$phpversion")) { echo 'e-mail send'; //header( "Location: http://www.myninelives.com/thank.html" ); } else { echo 'e-mail was not send'; } } Now if you send the mail it will say e-mail send or e-mail was not send. In the latter mail() doesn't work properly and their is something wrong with your PHP SMTP settings. Quote Link to comment https://forums.phpfreaks.com/topic/171850-i-cant-get-my-php-form-to-send-email/#findComment-906506 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.