cmbcorp Posted August 14, 2008 Share Posted August 14, 2008 hi guys/gals, having some troubles with my contact form. below is the code to call the process of the mail: <!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> <title>Inzagi | Subscribe</title> <link href="style.css" rel="stylesheet" type="text/css" /> <style type="text/css"> <!-- @import url("style.css"); body { background-color: #666666; } .style1 {color: #FFFFFF} .style3 { color: #FFFFFF; font-family: Arial, Helvetica, sans-serif; font-size: 10px; } .style6 {color: #FFCC00} .style23 { font-family: Arial, Helvetica, sans-serif; font-size: 14px; color: #666666; } .style24 {font-family: Arial, Helvetica, sans-serif; font-size: 12px; color: #666666; } --> </style> </head> <body> <br /> <table width="500" align="center" cellpadding="0" cellspacing="0"> <tr> <td colspan="7"><a href="http://www.inzagi.com.au/"></a></td> </tr> <tr> <td><div align="right"><a href="http://www.inzagi.com.au/"></a><a href="http://www.inzagi.com.au/"><img src="images/iznagi_logo.jpg" alt="Inzagi.com.au" width="146" height="71" border="0" align="left" longdesc="http://www.inzagi.com.au/" /></a></div></td> <td colspan="6"><div align="right"><span class="style1"><a href="http://www.inzagi.com.au/keylooks.html">key looks </a></span><span class="style6">|</span> <span class="style1"><a href="http://www.inzagi.com.au/stores.html">stores</a></span> <span class="style6">|</span> <span class="style1"><a href="http://www.inzagi.com.au/brands.html">brands</a></span> <span class="style6">|</span> <span class="style1"><a href="http://www.inzagi.com.au/news.html">news</a></span> <span class="style6">|</span> <span class="style1"><a href="http://www.inzagi.com.au/contactus.html">contact us </a></span></div></td> </tr> <tr> <td colspan="7"> </td> </tr> <tr> <td height="300" colspan="7" background="images/bg.jpg"><form method="post" action="process.php"> <table width="400" align="center"> <tr> <td class="style24"><div align="left">department:</div></td> <td> <div align="center"> <select name="sendto"> <option value="info@inzagi.com.au">Subscribers Dept</option> </select> </div></td> </tr> <tr> <td class="style24"><div align="left"><font color="red">*</font> name:</div></td> <td><div align="center"> <input size="25" name="Name" /> </div></td> </tr> <tr> <td class="style24"><div align="left"><font color="red">*</font> email:</div></td> <td><div align="center"> <input size="25" name="Email" /> </div></td> </tr> <tr> <td class="style24"><div align="left"><font color="red">*</font> age: </div></td> <td><div align="center"> <input size="25" name="Age" /> </div></td> </tr> <tr> <td class="style24"><div align="left"><font color="red">*</font> street: </div></td> <td><div align="center"> <input size="25" name="Street" /> </div></td> </tr> <tr> <td height="23" class="style24"><div align="left"><font color="red">*</font> suburb/state: </div></td> <td height="23"><div align="center"> <input size="25" name="Suburb" /> </div></td> </tr> <tr> <td height="23" class="style24"><div align="left"><font color="red">*</font> country: </div></td> <td height="23"><div align="center"> <input size="25" name="Country" /> </div></td> </tr> <tr> <td height="23" class="style24"><font color="red">*</font> mobile: </td> <td height="23"><div align="center"> <input size="25" name="Mobile" /> </div></td> </tr> <tr> <td colspan="2" align="center"><div align="left"> <input type="submit" name="send" value="Submit" /> </div></td> </tr> </table> </form></td> </tr> <tr> <td></td> <td></td> <td width="78"> </td> <td width="40"> </td> <td width="40"> </td> <td width="40"> </td> <td width="44"> </td> </tr> <tr> <td width="188"><div align="left"><span class="style3">© copyright 2008 Inzagi Pty Ltd</span></div></td> <td width="69"> </td> <td colspan="5"><div align="right"><a href="http://www.inzagi.com.au/subscribe.php">subscribe</a> <span class="style6">|</span> <a href="http://www.inzagi.com.au/privacy.html">privacy</a> <span class="style6">|</span> <span class="style3">powered by:</span> <a href="http://www.xicg.com">xicg.com</a> </div></td> </tr> </table> </body> </html> ok here is the process.php code: <?php $to = $_REQUEST['sendto'] ; $from = $_REQUEST['Email'] ; $name = $_REQUEST['Name'] ; $headers = "From: $from"; $subject = "Inzagi.com.au - Subscribe Form"; $fields = array(); $fields{"Name"} = "Name"; $fields{"Email"} = "Email"; $fields{"Age"} = "Age"; $fields{"Street"} = "Street"; $fields{"Suburb"} = "Suburb"; $fields{"Country"} = "Country"; $fields{"Mobile"} = "Mobile"; $body = "We have received the following information:\n\n"; foreach($fields as $a => $b) { $body.=sprintf("%20s: %s\n",$b,$_REQUEST[$a]); } $headers2 = "From: noreply@inzagi.com.au"; $subject2 = "Thank you for subscribing"; $autoreply = "Thank you for subscribing"; $validForm = TRUE; if($from=='') {print "You have not entered an email, please go back and try again. "; $validForm = false;} if($Email=='') {print "You have not entered a email, please go back and try again. ";$validForm = false;} if($Age=='') {print "You have not entered a Age, please go back and try again. "; $validForm = false;} if($Street=='') {print "You have not entered a Street, please go back and try again. "; $validForm = false;} if($Suburb=='') {print "You have not entered a Suburb/State, please go back and try again. "; $validForm = false;} if($Country=='') {print "You have not entered a country, please go back and try again. "; $validForm = false;} if($Mobile=='') {print "You have not entered a mobile, please go back and try again. "; $validForm = false;} if ($validForm){ $send = mail($to, $subject, $body, $headers); $send2 = mail($from, $subject2, $autoreply, $headers2); if($send) { header("Location: http://www.inzagi.com.au/thankyou.html"); } else { echo "We encountered an error sending your mail, please notify info@inzagi.com.au"; } } ?> after i submit this i get my error message as if i didnt enter anything in the form: You have not entered a email, please go back and try again. You have not entered a Age, please go back and try again. You have not entered a Street, please go back and try again. You have not entered a Suburb/State, please go back and try again. You have not entered a country, please go back and try again. You have not entered a mobile, please go back and try again. Even though I filled everything in. Any ideas? Your help would be very much appreciated. Regards, Jason. Quote Link to comment Share on other sites More sharing options...
btherl Posted August 14, 2008 Share Posted August 14, 2008 The variables are called $_REQUEST['Email'] (for example), rather than just $Email. Try this (with a similar change for the other lines): if($_REQUEST['Email']=='') {print "You have not entered a email, please go back and try again. ";$validForm = false;} Quote Link to comment Share on other sites More sharing options...
cmbcorp Posted August 14, 2008 Author Share Posted August 14, 2008 thanks so much.. it worked.. you guys are the best!!! cheers, jason. Quote Link to comment 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.