MUWhahahahaha Posted March 8, 2007 Share Posted March 8, 2007 hellooo, I am having problems with my register pages. people enter their details, country username secret question and answer ect. You can see everything they have to enter on nzbackcurrant.p.sitesquat.com. they then click review where a new page loads with all the details they have entered so they can check that their details are correct. They then click submit - and this is where i hit the problem. even tho all fields are entered into and everything is correct eg same passwords and email addres it still says "Please make sure you enter into all required fields before trying to submit." there must be something in the file insert.php that dosnt quite match up. I have tried everything (on my limited knowledge) I can think of. I have been through to make sure that all the field names match etc, but there is bound to be something that i have missed. any ideas? I can usually work out what the script i doing but this one has just got me completly confused. here is the html code for where they enter their details -> <!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>The New Zealand Blackcurrant Co-Op</title> <link rel="stylesheet" type="text/css" href="default.css" /> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"/> <meta name="description" content="description"/> <meta name="keywords" content="keywords"/> <meta name="author" content="author"/> <link rel="stylesheet" type="text/css" href="default.css" media="screen"/> <title>The New Zealand Blackcurrant Co-Op!</title> </head> <body> <br><br> <div class="container"> <div class="navigation"> <div class="title"> <h1><font color= #8B668B> <b>The New Zealand Blackcurrant Co-Op</b></h1> <h2>- - - - - - - - -</h2> </div> <a href="contact.html">Contact Us</a> <a href="member.html">Members</a> <a href="health.html">Health Benefits</a> <a href="products.html">Products</a> <a href="index.html">Home</a> <div class="clearer"><span></span></div> <br><br> <center><b><font size= 2><u>Purple</u> - The colour of good health from New Zealand Blackcurrants - delicious Daily!</b></center></font> </div> <div class="holder_top"></div> <div class="holder"> <!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>Registration Form</title> <link rel="stylesheet" type="text/css" href="global.css" /> <a name="top"></a> </head> <body> <center> <h1></h1> </center> <h3>Register</h3> <p><big>*</big> Required Information</p> <hr /> <p><b>1. Personal Details</b></p> <p>Please enter your personal details in the spaces provided.</p> <form action="review.php" method="post"> <table border="0" cellpadding="3"> <tr> <td>Title:</td> <td>First Name(s):</td> <td>Surname:</td> </tr> <tr> <td><select name="title"> <option value="Mr">Mr</option> <option value="Ms">Ms</option> <option value="Mrs">Mrs</option> <option value="Miss">Miss</option> <option value="Doctor">Doctor</option> <option value="Professor">Professor</option> </select><big>*</big></td> <td><input type="text" name="fname" maxlength="60" /> <big>*</big></td> <td><input type="text" name="sname" maxlength="60" /> <big>*</big></td> </tr> <tr> <td>Address:</td> <td>Address 2:</td> </tr> <tr> <td><input type="text" name="address" maxlength="50" size="30" /> <big>*</big></td> <td><input type="text" name="address2" maxlength="50" size="30" /></td> </tr> <tr> <td>Country:</td> <td>City:</td> </tr> <tr> <td> <select name="town"> (county list removed - too long) </select> <big>*</big></td> <td><input type="text" name="county" maxlength="30" size="30" /> <big>*</big></td> </tr> <tr> <td>Post Code:</td> </tr> <tr> <td><input type="text" name="pcode" maxlength="10" size="7" /> <big>*</big></td> </tr> <tr> <td>Telephone Number:</td> </tr> <tr> <td><input type="text" name="tel_num" maxlength="15" size="15" /> <big>*</big></td> </tr> <tr> <td>Email:</td> <td>Re-Enter Email:</td> </tr> <tr> <td><input type="text" name="email" maxlength="50" size="30" /> <big>*</big></td> <td><input type="text" name="email2" maxlength="50" size="30" /> <big>*</big></td> </tr> <tr> <td>I Prefer Plain Text Email <input type="checkbox" name="email_type" value="1" /></td> </tr> </table> <br /> <hr /> <p><b>2. User Details</b></p> <p>Please enter the username and password you wish to use to access this site. Your username and password must be unique and if your chosen details are already taken you will have to choose another. The secret question and answer are used in case you forget your login details. Choose a question which you will easily remember the answer to in case of an emergency.</p> <table border="0" cellpadding="3"> <tr> <td>Enter A Username:</td> </tr> <tr> <td><input type="text" name="user_name" maxlength="10" /> <big>*</big></td> </tr> <tr> <td>Enter A Password:</td> <td>Confirm Your password:</td> </tr> <tr> <td><input type="password" name="pword" maxlength="16" /> <big>*</big></td> <td><input type="password" name="pword2" maxlength="16" /> <big>*</big></td> </tr> <tr> <td>Choose Your Secret Question:</td> </tr> <tr> <td><select name="secretq"> <option value="1">What is your mothers maiden name?</option> <option value="2">What is the name of your favorite pet?</option> <option value="3">What is your favorite colour?</option> <option value="4">What town were you born in?</option> <option value="5">What is your best friend called?</option> </select><big>*</big></td> </tr> <tr> <td>Type Your Secret Answer:</td> </tr> <tr> <td><input type="password" name="secreta" maxlength="20" /> <big>*</big></td> </tr> </table> <br /> <hr /> <p><b>3. Terms & Conditions</b></p> <p>Please read the terms and conditions carefully before submitting.</p> <table border="0" cellpadding="3"> <tr> <td>I agree to the <a href="yourterm.htm">terms and conditions.</a></td> <td><input type="checkbox" value="1" name="terms" /> <big>*</big></td> </tr> </table> <p id="c"><b>Warning!</b> In order for you to register successfully your browser must have cookies enabled. <br /> <br /> <input type="submit" value="Review Your Details" /> </p> </form> <a href="#top">Top of Page</a><br><br> <div class="footer">All Rrights Reserved © 2007 New Zealand BlackCurrant Co-Op</a>. </div> </body> </html> and now the php script. this is the script where it should save the details to the database and then redirect them to activation page but its not getting that far because it thinks that the fields havnt been entered into, and is giving me the error page. <?php $error = 0; $name = "/^[-!#$%&\'*+\\.\/0-9=?A-Z^_'{|}~]+"; $host = "([-0-9A-Z]+\.)+"; $domain = "([0-9A-Z]){2,4}$/i"; $cus = array(); $cus[0] = $_POST['title']; $cus[1] = $_POST['fname']; $cus[2] = $_POST['sname']; $cus[3] = $_POST['address']; $cus[4] = $_POST['town']; $cus[5] = $_POST['county']; $cus[6] = $_POST['pcode']; $cus[7] = $_POST['tel_num']; $cus[8] = $_POST['user_name']; $cus[9] = $_POST['secretq']; $cus[10] = $_POST['secreta']; $email = $_POST['email']; $chkEmail = $_POST['email2']; $type = $_POST['email_type']; $pword = $_POST['pword']; $chkPword = $_POST['pword2']; $add2 = $_POST['address2']; $terms = $_POST['terms']; $cus[1] = trim($cus[1]); $cus[2] = trim($cus[2]); $cus[3] = trim($cus[3]); $cus[4] = trim($cus[4]); $cus[5] = trim($cus[5]); $cus[6] = trim($cus[6]); $cus[7] = trim($cus[7]); $cus[8] = trim($cus[8]); $cus[10] = trim($cus[10]); $email = trim($email); $chkEmail = trim($chkEmail); $pword = trim($pword); $chkPword = trim($chkPword); $add2 = trim($add2); if($type != 1) { $type = 0; } foreach($cus as $check) { if($check == null) { $error = 1; } } if(($error == 0) && ($email != $chkEmail)) // error checking { $error = 2; } if(($error == 0) && (($pword != $chkPword) || ($pword == null || $chkPword == null))) { $error = 3; } if(($error == 1) && ($email != $chkEmail)) { $error = 4; } if(($error == 1) && (($pword != $chkPword) || ($pword == null || $chkPword == null))) { $error = 5; } if(($error == 2) && (($pword != $chkPword) || ($pword == null || $chkPword == null))) { $error = 6; } if(($error == 4) && (($pword != $chkPword) || ($pword == null || $chkPword == null))) { $error = 7; } if(!preg_match($name."@".$host.$domain,$email)) { $error = 8; } if($cus[8] == $pword) { $error = 9; } if(($cus[8] == "administrator") || ($cus[8] == "Administrator") || ($cus[8] == "admin") || ($cus[8] == "Admin") || ($cus[8] == "ADMINISTRATOR") || ($cus[8] == "ADMIN")) { $error = 10; } if(($error == 0) && ($terms == 1 && $cus[8] != $pword)) { $cUsername = crypt($cus[8], true); $link = mysql_connect("localhost", "loginname", "yourpassword"); // edit as required mysql_select_db("customer_db"); // edit as requried $sql3 = mysql_query("SELECT C_EMAIL FROM customer where C_EMAIL = '$email'", $link); $num3 = mysql_num_rows($sql3); if($num3 != 0) { $msg = ("<b>Email Already Registered:</b><br>We are sorry but the email you have entered has already been registered, please use another or try to recover your previous account."); mysql_close($link); } else { $sql = mysql_query("SELECT C_USER_NAME FROM CUSTOMER where C_USER_NAME = '$cus[8]'", $link); $num = mysql_num_rows($sql); if($num != 0) { $msg = ("<b>Username Already In Use:</b><br>We are sorry but the username you have chosen has already been taken. Please go back and try another or add numbers to make it unique."); mysql_close($link); } else { mysql_query("INSERT INTO customer (C_TITLE, C_FNAME, C_SNAME, C_ADDRESS, C_ADDRESS2, C_TOWN, C_COUNTY, C_PCODE, C_TEL_NUM, C_EMAIL, C_PWORD, C_USER_NAME, C_KEY, C_SECRET_A, C_SECRET_Q, C_MAIL_TYPE) values (UPPER('$cus[0]'),UPPER('$cus[1]'),UPPER('$cus[2]'),UPPER('$cus[3]'),U PPER('$add2'),UPPER('$cus[4]'),UPPER('$cus[5]'),UPPER('$cus[6]'),'$cus [7]',LOWER('$email'),'$pword','$cus[8]','$cUsername','$cus[10]','$cus[ 9]','$type')", $link); mysql_close($link); setcookie("key:", $cUsername, time()+300); // sets cookie header("Location: activate.php"); // directs to activation script*/ } } } else if($error == 1) { $msg = ("<b>Required Details</b><br>Please make sure you enter into all required fields before trying to submit."); } else if($error == 2) { $msg = ("<b>Email Address Mismatch:</b><br>Please enter identical email addresses into the spaces provided before trying to submit."); } else if($error == 3) { $msg = ("<b>Password Entry Mismatch</b><br>Please enter identical passwords into the spaces provided before trying to submit."); } else if($error == 4) { $msg = ("<b>Required Details / Email Mismatch</b><br>Please enter into all required fields and make sure the email addresses match before trying to submit."); } else if($error == 5) { $msg = ("<b>Required Details / Password Mismatch</b><br>Please enter your details into all required fields and make sure the passwords are matching before trying to submit."); } else if($error == 6) { $msg = ("<b>Email Mismatch / Password Mismatch</b><br>Please check both the email addresses and the passwords you have entered match before trying to submit."); } else if($error == 7) { $msg = ("<b>Re-Check Details</b><br>Please re-check all your details. You have omitted required details and your passwords and email address entries do not match."); } else if($error == { $msg = ("<b>Invalid Email Address</b><br>The email address you have entered contains invalid characters or is in the incorrect format You must have a valid email address in order for your account to be setup."); } else if($error == 9) { $msg = ("<b>Username & Password Match</b><br>Username and passwords are the same. This is not allowed, please enter a different password and try again."); } else if($error == 10) { $msg = ("<b>Reserved Username Problem</b><br>The username you have chosen is reserved. Please choose a different username and try again."); } if(($error == 0) && ($terms != 1)) { $msg = ("<b>Terms & Conditions Problem</b><br>You have not ticked the box to say you have read the terms and conditions. Please read them and check the box to continue."); } if(($error != 0) && ($terms != 1)) { $msg = ("<b>Recheck Details!</b><br>There are incorrect details on your submission form and you have not checked the box to say you have read the terms and conditions. Please re-check your form, read the terms and conditions and re-submit."); } ?> <!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>Registration Problem</title> <link rel="stylesheet" type="text/css" href="global.css" /> <script language="JavaScript" type="text/javascript"> <!-- function goBack() { window.history.go(-2); } //--> </script> </head> <body> <center> <h1>Registration Problem</h1> </center> <p>There is a problem. Read on to find out how to solve the problem and press the 'Try Again' button to retry.</p> <p><?php echo($msg); ?></p> <form> <input type="button" value="Try Again!" onclick="goBack()" /> </form> </body> </html> only thing that i can think is wrong is that one of the table name bits dont match up or something. thank you very very much for you help. Quote Link to comment Share on other sites More sharing options...
quasiman Posted March 9, 2007 Share Posted March 9, 2007 Your first HTML page is....interesting. You know you have two headers? Anyway, your review.php file has a problem in the INSERT code, Line 126: U PPER('$add2') should be: UPPER('$add2') I don't know for sure if that's the problem, but it's as likely as anything. 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.