tmharrison Posted February 10, 2007 Share Posted February 10, 2007 This is just a registration page, that I want to gather all the registration info from user, and have it send me an email with their information, so i can input their info into my MySQl database. I can't seem to get the errors if the fields are empty to echo nor can i get the page to go anywhere except the registration page. If you click the submit button "Click to Send Information" it just refreshes the same page. I want it to echo the errors, because it is empty. Also, when I do fill the form out correctly it just does the same refresh. Confused? Can someone help me out on this, I have posted the php script/page that I am having the issue with. Thank you, Tina <HTML> <HEAD> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> <meta name="description" content="Virtual Home Debut empowers you, the Agent or the Seller to help potential buyers visualize themselves living in your listing or home."> <meta name="keywords" content="virtual tours, real estate virtual tours, virtual tour provider, virtual home debut, stunning 360 panoramas, real estate agents, for sale by owner"> <TITLE>Virtual Home Debut - Professional Real Estate Virtual Tours</TITLE> <link href="style.css" rel="stylesheet" type="text/css"> <style type="text/css"> <!-- .style1 {font-size: 14px} #Layer1 { position:absolute; left:614px; top:508px; width:216px; height:14px; z-index:1; } #Layer2 { position:absolute; left:693px; top:757px; width:88px; height:25px; z-index:2; } #Layer3 { position:absolute; left:648px; top:803px; width:135px; height:25px; z-index:3; } #Layer4 { position:absolute; left:792px; top:776px; width:127px; height:16px; z-index:4; } #Layer5 { position:absolute; left:809px; top:961px; width:89px; height:58px; z-index:5; } --> </style> </HEAD> <BODY BGCOLOR=#FFFFFF LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0> <!-- ImageReady Slices (photo1.psd) --> <TABLE WIDTH=737 height="728" BORDER=0 align="center" CELLPADDING=0 CELLSPACING=0 bgcolor="#FBFBFB" class="border"> <!--DWLayoutTable--> <TR> <TD height="434" align="center" valign="top" bgcolor="#C7C7C7"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="737" height="435" align="left"> <param name="movie" value="header6.swf"> <param name="quality" value="high"> <param name="wmode" value="transparent"><param name="SCALE" value="exactfit"> <embed src="header6.swf" width="737" height="435" align="left" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent" scale="exactfit"></embed> </object></TD> </TR> <TR> <TD width="681" height="250" align="left" valign="top"><table width="96%" border="0" align="right" cellpadding="0" cellspacing="0"> <!--DWLayoutTable--> <tr> <td width="42" align="left" valign="top"><table width="91%" border="0" align="left" cellpadding="0" cellspacing="0"> <tr> <td height="25" colspan="4" align="right" valign="top"><div align="left"><img src="images/clienta.jpg" width="212" height="17" border="0"></div></td> </tr> <tr> <td height="15" colspan="4" align="left" valign="bottom" class="graytext"><hr noshade></td> </tr> <tr> <td height="15" colspan="4" align="left" valign="bottom" class="graytext"><div class="redtext" id="errors"> <? if(isset($_POST['Send'])){ $errors = array(); // Initialize error array. if(empty($_POST['name'])) { $errors[] = 'You did not enter your Name.'; } if(empty($_POST['email'])) { $errors[] = 'You did not enter your Email Address.'; } if(empty($_POST['address'])) { $errors[] = 'You did not enter your Address.'; } if(empty($_POST['city'])) { $errors[] = 'You did not enter your City.'; } if(empty($_POST['state'])) { $errors[] = 'You did not enter your State.'; } if(empty($_POST['zip'])) { $errors[] = 'You did not enter your Zip.'; } if(empty($_POST['hphone'])) { $errors[] = 'You did not enter your Home Phone.'; } if(empty($_POST['cphone'])) { $errors[] = 'You did not enter your Cell Phone.'; } if(empty($_POST['wphone'])) { $errors[] = 'You did not enter your Work Phone.'; } if(empty($errors)) { $name=$_POST['name']; $email=$_POST['email']; $address=$_POST['address']; $address1=$_POST['address1']; $city=$_POST['city']; $state=$_POST['state']; $zip=$_POST['zip']; $hphone=$_POST['hphone']; $cphone=$_POST['cphone']; $wphone=$_POST['wphone']; $fphone=$_POST['fphone']; $comments=$_POST['comments']; $to="[email protected]"; $message="$name just filled in your registration form.\n\nThey said: $comments\n\nTheir e-mail address is: $email\n Their address is: $address., $address1., $city, $state, $zip\n Their Phones are as follows Home: $hphone Cell: $cphone Work: $wphone Fax: $fphone"; if(mail($to,"Registration From Virtual Home Debut",$message,"From: $email\n")) { header('Location:http://virtualhomedebut.com/registerok.html'); } else { echo '<h1 id=listerrors">Error!</h1><p class="error">The following error(s) occurred:<br />'; foreach ($errors as $msg) { echo " - $msg<br />\n"; } } } } ?> <a name="listerrors"></a></div></td> </tr> <tr> <td height="15" colspan="3" align="left" valign="bottom" class="graytext">Name</td> <td height="15" align="left" valign="bottom" class="graytext">E-mail</td> </tr> <form method="post" action="register.php"> <tr> <td height="20" colspan="3" align="left" valign="top"><input name="name" type="text" class="graytext1" id="name" size="60"> <td height="20" align="left" valign="top"><input name="email" type="text" class="graytext1" id="email"> <tr> <td height="15" colspan="2" align="left" valign="bottom" class="graytext">Address <td height="15" colspan="2" align="left" valign="bottom" class="graytext">Add'l Address <tr> <td height="20" colspan="2" align="left" valign="top"><input name="address" type="text" class="graytext1" id="address" size="40"> <td height="20" colspan="2" align="left" valign="top"><input name="address1" type="text" class="graytext1" id="address1" size="40"> <tr> <td height="20" colspan="2" align="left" valign="bottom" class="graytext">City <td width="119" height="20" align="left" valign="bottom" class="graytext">State <td width="147" height="20" align="left" valign="bottom" class="graytext">Zip <tr> <td height="20" colspan="2" align="left" valign="top"><input name="city" type="text" class="graytext1" id="city" size="40"> <td align="left" valign="top"><input name="state" type="text" class="graytext1" id="state" size="5"> <td align="left" valign="top"><input name="zip" type="text" class="graytext1" id="zip" size="10"> <tr> <td width="131" height="20" align="left" valign="bottom" class="graytext">Home Phone <td width="124" height="20" align="left" valign="bottom" class="graytext">Cell Phone <td height="20" align="left" valign="bottom" class="graytext">Work Phone <td height="20" align="left" valign="bottom" class="graytext">Fax Phone <tr> <td width="131" height="20" align="left" valign="top" class="graytext"><input name="hphone" type="text" class="graytext1" id="hphone" size="15"> <td align="left" valign="top" class="graytext"><input name="cphone" type="text" class="graytext1" id="cphone" size="15"> <td height="20" align="left" valign="top" class="graytext"><input name="wphone" type="text" class="graytext1" id="wphone" size="15"> <td height="20" align="left" valign="top" class="graytext"><input name="fphone" type="text" class="graytext1" id="fphone" size="12"> <tr> <td height="20" colspan="4" align="left" valign="bottom" class="graytext">Enter any comments below: <tr> <td colspan="4" align="left" valign="top" class="graytext"><textarea name="comments" cols="60" class="graytext1" id="comments"></textarea> <div align="right"> <input type="submit" name="Send" value="Click to Send Information" id="Send"> </div> </form> </table> </table> </TR> <TR> <TD height="10" class="redtext"><!--DWLayoutEmptyCell--> </TD> </TR> <TR> <TD height="10" class="redtext"><div align="center">You will be contacted within 24 hours via email with your registration information. Thank you for registering with VHD!</div></TD> </TR> <TR> <TD height="19" align="left" valign="top" class="redtext"><div align="right"> <blockquote> <p><font size="-1"><span class="graytext">Copyright 2007, Virtual Home Debut All rights reserved.</span></font></p> </blockquote> </div></TD> </TR> <TR> <TD height="5" align="center" valign="top" class="graytext"><!--DWLayoutEmptyCell--> </TD> </TR> </TABLE> <!-- End ImageReady Slices --> </BODY> </HTML> Link to comment https://forums.phpfreaks.com/topic/37935-help-php-wont-show-errors-or-goto-correct-page-if-no-errors/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.