jimlawrnc Posted November 15, 2007 Share Posted November 15, 2007 I have a signup form and a signupcheck script when i click submit the result is a blank page signup.php <? ?> <!doctype html public "-//w3c//dtd html 3.2//en"> <html> <head> <title>Fast Fix Pro Signup</title> <script type="text/javascript"> function validate(form) { if (!document.form1.agree.checked) { alert("Please Read the guidlines and check the box below ."); return false; } return true; } </script> </head> <body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#800080" alink="#ff0000"> <br/> <br/> <table border='0' width='50%' cellspacing='0' cellpadding='0' align=center><form name=form1 method=post action=signupck.php onsubmit='return validate(this)'><input type=hidden name=todo value=post> <tr bgcolor='#f1f1f1'><td align=center colspan=2><font face='Verdana' size='2' ><b>Signup</b></td></tr> <tr ><td > <font face='Verdana' size='2' >Company</td><td ><font face='Verdana' size='2'><input type=text name=company></td></tr> <tr bgcolor='#f1f1f1'><td > <font face='Verdana' size='2' >User ID</td><td ><font face='Verdana' size='2'><input type=text name=userid></td></tr> <tr ><td > <font face='Verdana' size='2' >Password</td><td ><font face='Verdana' size='2'><input type=text name=password></td></tr> <tr bgcolor='#f1f1f1'><td > <font face='Verdana' size='2' >Re-enter Password</td><td ><font face='Verdana' size='2'><input type=text name=password2></td></tr> <tr ><td ><font face='Verdana' size='2' > Email</td><td ><input type=text name=email></td></tr> <tr bgcolor='#f1f1f1'><td > <font face='Verdana' size='2' >First Name</td><td ><font face='Verdana' size='2'><input type=text name=fname></td></tr> <tr ><td > <font face='Verdana' size='2' >Last Name</td><td ><font face='Verdana' size='2'><input type=text name=lname></td></tr> <tr bgcolor='#f1f1f1'><td > <font face='Verdana' size='2' >Address</td><td ><font face='Verdana' size='2'><input type=text name=address></td></tr> <tr ><td > <font face='Verdana' size='2' >City</td><td ><font face='Verdana' size='2'><input type=text name=city></td></tr> <tr bgcolor='#f1f1f1'><td > <font face='Verdana' size='2' >State</td><td ><font face='Verdana' size='2'><select name="state"> <option value="chooseone" SELECTED>Choose One</option> <option value="AL">Al</option> <option value="AK">Ak</option> <option value="AZ">Az</option> <option value="AR">Ar</option> <option value="CA">Ca</option> <option value="CO">Co</option> <option value="CT">Ct</option> <option value="DE">De</option> <option value="FL">Fl</option> <option value="GA">Ga</option> <option value="HI">Hi</option> <option value="ID">Id</option> <option value="IL">Il</option> <option value="IN">In</option> <option value="IA">Ia</option> <option value="KS">Ks</option> <option value="KY">Ky</option> <option value="LA">La</option> <option value="ME">Me</option> <option value="MD">Md</option> <option value="MA">Ma</option> <option value="MI">Mi</option> <option value="MN">Mn</option> <option value="MS">Ms</option> <option value="MO">Mo</option> <option value="MT">Mt</option> <option value="NE">Ne</option> <option value="NV">Nv</option> <option value="NH">Nh</option> <option value="NJ">Nj</option> <option value="NM">Nm</option> <option value="NY">Ny</option> <option value="NC">Nc</option> <option value="ND">Nd</option> <option value="OH">Oh</option> <option value="OK">Ok</option> <option value="OR">Or</option> <option value="PA">Pa</option> <option value="RI">Ri</option> <option value="SC">Sc</option> <option value="SD">Sd</option> <option value="TN">Tn</option> <option value="TX">Tx</option> <option value="UT">Ut</option> <option value="VT">Vt</option> <option value="VA">Va</option> <option value="WA">Wa</option> <option value="WV">Wv</option> <option value="WI">Wi</option> <option value="WY">Wy</option> </select> </td></tr> <tr ><td > <font face='Verdana' size='2' >Zip Code</td><td ><font face='Verdana' size='2'><input type=text name=zipcode></td></tr> <tr bgcolor='#f1f1f1'><td > <font face='Verdana' size='2' >Phone #</td><td ><font face='Verdana' size='2'> <input type=text name=phone maxlength="13" ></td></tr> <tr ><td > <font face='Verdana' size='2' >I agree to terms and conditions</td><td ><font face='Verdana' size='2'><input type=checkbox name=agree value='yes'></td></tr> <tr ><td align=center colspan=2><input type=submit value=Signup></td></tr> </table> <center> <br><font face='Verdana' size='2' ><a href='login.php'>Already a member ? Please Login</a></font></center> </body> </html> signupck.php <? include "include/z_db.php";// database connection details stored here ?> <!doctype html public "-//w3c//dtd html 3.2//en"> <html> <head> <title>Fast Fix Pro Signup</title> </head> <body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#800080" alink="#ff0000"> <? if(isset($todo) and $todo=="post"){ $status = "OK"; $msg=""; // if userid is less than 3 char then status is not ok if(!isset($userid) or strlen($userid) <3){ $msg=$msg."User id should be =3 or more than 3 char length<BR>"; $status= "NOTOK";} if(mysql_num_rows(mysql_query("SELECT userid FROM plus_signup WHERE userid = '$userid'"))){ $msg=$msg."Userid already exists. Please try another one<BR>"; $status= "NOTOK";} if ( strlen($password) < 3 ){ $msg=$msg."Password must be more than 3 char legth<BR>"; $status= "NOTOK";} if ( $password <> $password2 ){ $msg=$msg."Both passwords are not matching<BR>"; $status= "NOTOK";} if ($agree<>"yes") { $msg=$msg."You must agree to terms and conditions<BR>"; $status= "NOTOK";} if($status<>"OK"){ echo "<font face='Verdana' size='2' color=red>$msg</font><br><input type='button' value='Retry' onClick='history.go(-1)'>"; }else{ // if all validations are passed. $query=mysql_query("insert into members(company, username, password, email, fname, lname, address, city, state, zip, phone) values('$company','$userid','$password','$email','$fname', '$lname','$address', '$city', '$state', '$zipcode', '$phone',)"); echo "<font face='Verdana' size='2' color=green>Welcome, You have successfully signed up<br><br><a href=login.php>Click here to login</a><br></font>"; } } ?> </body> </html> Quote Link to comment Share on other sites More sharing options...
MadTechie Posted November 15, 2007 Share Posted November 15, 2007 change if(isset($todo) and $todo=="post"){ to if(isset($_POST['todo']) and $_POST['todo']=="post"){ also your form is missing quotes it should be like this <form name="form1" method="post" action="signupck.php" <input type="hidden" name="todo" etc etc Quote Link to comment Share on other sites More sharing options...
jimlawrnc Posted November 15, 2007 Author Share Posted November 15, 2007 I went through the form and put " around each name With the change you suggested i get into the validation area and receive User id should be =3 or more than 3 char length Password must be more than 3 char legth You must agree to terms and conditions Quote Link to comment Share on other sites More sharing options...
MadTechie Posted November 15, 2007 Share Posted November 15, 2007 change $userid to $_POST['userid'] $password to $_POST['password'] $password2 to $_POST['password2'] Quote Link to comment Share on other sites More sharing options...
jimlawrnc Posted November 15, 2007 Author Share Posted November 15, 2007 made the changes <? include "include/z_db.php";// database connection details stored here ?> <!doctype html public "-//w3c//dtd html 3.2//en"> <html> <head> <title>Fast Fix Pro Signup</title> </head> <body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#800080" alink="#ff0000"> <? //if(isset($todo) and $todo=="post"){ if(isset($_POST['todo']) and $_POST['todo']=="post"){ $status = "OK"; $msg=""; // if userid is less than 3 char then status is not ok if(!isset($_POST['$userid']) or strlen($_POST['$userid']) <3){ $msg=$msg."User id should be =3 or more than 3 char length<BR>"; $status= "NOTOK";} if(mysql_num_rows(mysql_query("SELECT userid FROM plus_signup WHERE userid = '$userid'"))){ $msg=$msg."Userid already exists. Please try another one<BR>"; $status= "NOTOK";} if ( strlen($_POST['$password']) < 3 ){ $msg=$msg."Password must be more than 3 char legth<BR>"; $status= "NOTOK";} if ( $_POST['$password'] <> $_POST['$password2'] ){ $msg=$msg."Both passwords are not matching<BR>"; $status= "NOTOK";} if ($agree<>"yes") { $msg=$msg."You must agree to terms and conditions<BR>"; $status= "NOTOK";} if($status<>"OK"){ echo "<font face='Verdana' size='2' color=red>$msg</font><br><input type='button' value='Retry' onClick='history.go(-1)'>"; }else{ // if all validations are passed. $query=mysql_query("insert into members(company, userid, password, email, fname, lname, address, city, state, zip, phone) values('$company','$userid','$password','$email','$fname', '$lname','$address', '$city', '$state', '$zipcode', '$phone',)"); echo "<font face='Verdana' size='2' color=green>Welcome, You have successfully signed up<br><br><a href=login.php>Click here to login</a><br></font>"; } } ?> </body> </html> live version http://74.42.245.172/~jim/ffp/signup.php Quote Link to comment Share on other sites More sharing options...
MadTechie Posted November 15, 2007 Share Posted November 15, 2007 you changed to $_POST['$password'], which is wrong.. change $userid to $_POST['userid'] $password to $_POST['password'] $password2 to $_POST['password2'] BUT instead i used extract <?php include "include/z_db.php";// database connection details stored here ?> <!doctype html public "-//w3c//dtd html 3.2//en"> <html> <head> <title>Fast Fix Pro Signup</title> </head> <body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#800080" alink="#ff0000"> <?php extract($_POST); //<---I don't recommand this really if(isset($todo) and $todo=="post") { $status = "OK"; $msg=""; // if userid is less than 3 char then status is not ok if(!isset($userid) or strlen($userid) <3) { $msg=$msg."User id should be =3 or more than 3 char length<BR>"; $status= "NOTOK"; } if(mysql_num_rows(mysql_query("SELECT userid FROM plus_signup WHERE userid = '$userid'"))) { $msg=$msg."Userid already exists. Please try another one<BR>"; $status= "NOTOK"; } if ( strlen($password) < 3 ) { $msg=$msg."Password must be more than 3 char legth<BR>"; $status= "NOTOK"; } if ( $password <> $password2 ) { $msg=$msg."Both passwords are not matching<BR>"; $status= "NOTOK"; } if ($agree<>"yes") { $msg=$msg."You must agree to terms and conditions<BR>"; $status= "NOTOK"; } if($status<>"OK") { echo "<font face='Verdana' size='2' color=red>$msg</font><br><input type='button' value='Retry' onClick='history.go(-1)'>"; }else{ // if all validations are passed. $query=mysql_query("insert into members(company, userid, password, email, fname, lname, address, city, state, zip, phone) values('$company','$userid','$password','$email','$fname', '$lname','$address', '$city', '$state', '$zipcode', '$phone',)"); echo "<font face='Verdana' size='2' color=green>Welcome, You have successfully signed up<br><br><a href=login.php>Click here to login</a><br></font>"; } } ?> </body> </html> Quote Link to comment Share on other sites More sharing options...
jimlawrnc Posted November 15, 2007 Author Share Posted November 15, 2007 that works but i guess my insert statement doesnt work Quote Link to comment Share on other sites More sharing options...
MadTechie Posted November 15, 2007 Share Posted November 15, 2007 change to $query=mysql_query("insert into members(company, userid, password, email, fname, lname, address, city, state, zip, phone) values('$company','$userid','$password','$email','$fname', '$lname','$address', '$city', '$state', '$zipcode', '$phone')"); changed '$phone', to '$phone' Quote Link to comment Share on other sites More sharing options...
jimlawrnc Posted November 15, 2007 Author Share Posted November 15, 2007 with the extract from there how can i print to the screen all the post field data ? Quote Link to comment Share on other sites More sharing options...
jimlawrnc Posted November 15, 2007 Author Share Posted November 15, 2007 Got it One of my fields was misspelled Quote Link to comment Share on other sites More sharing options...
MadTechie Posted November 15, 2007 Share Posted November 15, 2007 i would guess, fname lname if this is solved can you please click solved bottom left 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.