prakash911 Posted March 17, 2010 Share Posted March 17, 2010 i cant seem to figure out why, but nothing is happening when i click the button to submit the signup form. can you guys tell me what the problem is. <?php require('db_connect.php'); $database = "chennupatidb"; $db_link = db_connect($database); display_signup_page(); ?> <?php function display_signup_page() { $self = $_SERVER['PHP_SELF']; ?> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office"> <head> <link href="books.css" rel="stylesheet" type="text/css"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Sign Up</title> <script type="text/javascript"> function validate(table) { if (!document.table.agree.checked){ alert("Please Read the guidlines and check the box below ."); return false; } return true; } </script> <style type="text/css"> .style1 { font-size: medium; } .style2 { margin-left: 240px; } </style> </head> <body> <div id="pageWrap"> <div id="header"> </div> <div id="navBar"> <ul> <li><a href="Bookstore.php" title="Homw">Home</a></li> <li><a href="search.php" title="Search">Search</a></li> <li><a href="forum.php" title="Forum">Forums</a></li> <li><a href="login.php" title="Contact">Login</a></li> <li class="end"> <a href="signup.php" title="signup">Sign Up</a></li> <li></li> </ul> </div> <div id="container" class="clearfix"> <div id="centerColumn"> <h2>Create an Account</h2> <p><font size="-1">If you already have a SC Bookstore Account, you can <a href="login.html"> login in here</a>.</font></p> <p class="style1"><strong>Required information</strong></p> <table border='0' width='50%' cellspacing='0' cellpadding='0' align="center"> <form method="post" action="<?php echo $self ?>" onsubmit='return validate(this)'> <input type="hidden" name="table" value="post"> <tr bgcolor='#f1f1f1'><td align="center" colspan=2><font face='Verdana' size='2' ><b>Signup</b></font></td></tr> <tr ><td > <font face='Verdana' size='2' >User ID</font></td><td ><font face='Verdana' size='2'></font><input type="text" name="userid"></td></tr> <tr bgcolor='#f1f1f1'><td > <font face='Verdana' size='2' >Password</font></td><td ><font face='Verdana' size='2'><input type='password' name="password"></font></td></tr> <tr ><td > <font face='Verdana' size='2' >Re-enter Password</font></td><td ><font face='Verdana' size='2'><input type='password' name="password2"></font></td></tr> <tr bgcolor='#f1f1f1'><td style="height: 21px" ><font face='Verdana' size='2' > Email<br> ([email protected])</font></td><td style="height: 21px" ><input type='text' name='email'></td></tr> <tr ><td > <font face='Verdana' size='2' >First Name</font></td><td ><font face='Verdana' size='2'><input type="text" name="firstname"></font></td></tr> <tr ><td > <font face='Verdana' size='2' >Last Name</font></td><td ><font face='Verdana' size='2'><input type="text" name="lastname"></font></td></tr> <tr bgcolor='#f1f1f1'><td > <font face='Verdana' size='2' >Sex</font></td><td ><font face='Verdana' size='2'> <input type='radio' value="male" checked="checked" name="sex">Male <input type='radio' value="female" name='sex'>Female</font></td></tr> <tr ><td > <font face='Verdana' size='2' >I agree to terms and conditions</font></td> <td > Yes<input name="agree" type="checkbox" value="yes">No<input name="agree" type="checkbox" value="no"></td></tr> </form> </table> <p class="style2"> <input name="signup" type="submit" value="signup"></p> </div> </div> <div id="footer"> <p> SC Books • Est.2010</p> </div> </div> </body> </html> <?php } ?> <?php function display_signup_output_page() { ?> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office"> <head> <link href="books.css" rel="stylesheet" type="text/css"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>SC BookStore</title> </head> <body> <div id="pageWrap"> <div id="header"> </div> <div id="navBar"> <ul> <li><a href="Bookstore.php" title="Homw">Home</a></li> <li><a href="search.php" title="Search">Search</a></li> <li class="end"><a href="forum.php" title="Forum">Forums</a></li> <li></li> </ul> </div> <div id="container" class="clearfix"> <div id="centerColumn"> <h2> Thank You For Signing Up!</h2> <p> </p> <h3>You Can Login here </h3><p><a href="login.php">Click here to login</p> </div> </div> </div> </body> </html> <?php } ?> <?php extract($_POST); $self = $_SERVER['PHP_SELF']; $user_id = isset($_REQUEST['userid']) ? $_REQUEST['userid'] : ''; $first_name = isset($_REQUEST['firstname']) ? $_REQUEST['firstname'] : ''; $last_name = isset($_REQUEST['lastname']) ? $_REQUEST['lastname'] : ''; $password_one = isset($_REQUEST['password']) ? $_REQUEST['password'] : ''; $password_two = isset($_REQUEST['password2']) ? $_REQUEST['password2'] : ''; $email = isset($_REQUEST['email']) ? $_REQUEST['email'] : ''; $agree = isset($_REQUEST['agree']) ? $_REQUEST['agree'] : ''; $signup = isset($_REQUEST['signup']) ? $_REQUEST['signup'] : ''; $table = isset($_REQUEST['table']) ? $_REQUEST['table'] : ''; if (isset($_REQUEST['signup'])) { $expression = "/^[^0-9][A-z0-9_]+([.][A-z0-9_]+)*[@][A-z0-9_]+([.][A-z0-9_]+)*[.][A-z]{2,4}$/"; $errors = 0; if(!isset($user_id) or strlen($user_id) < 5) { echo "<br/>\nUser ID must be 5 letters or longer<br/>\n"; $errors++; } if(!ctype_alnum($user_id)) { echo "<br/>\nUser id should contain alphanumeric values only<br/>\n"; $errors++; } if(mysql_num_rows(mysql_query("SELECT userid FROM sign_up WHERE userid = '$userid'"))) { echo "<br/>\nThis User ID already exists. Please try another one<br/>\n"; $errors++; } if (strlen($password_one) < 6 ) { echo "<br/>\nPassword must be more than 6 char legth<br/>\n"; $errors++; } if ($password_one <> $password_two) { echo "<br/>\nPasswords are not matching<br/>\n"; $errors++; } if(strlen($email) == 0) { echo "Please go back and check (ex:[email protected])<br/>\n"; $errors++; } if (! $agree == "yes") { echo "<br/>\nYou must agree to terms and conditions<br\>\n"; $errors++; } if($errors >= 1) { echo "<br/>\n<input type='button' value='Retry' onClick='history.go(-1)'>\n"; } if($errors == 0) { display_signup_output_page(); $query = "insert into sign_up(userid,password,email,firstname,lastname,sex) values('$userid','$password','$email','$firstname','$lastname','$sex')"; $result = mysql_query($query,$db_link); $query2 = "insert into members(username,password,email) values('$userid','$password','$email')"; $result2 = mysql_quert($query2,$db_link); echo "<br/><h1>Welcome,\n You have successfully signed up\n<br/><br/>\n<a href=login.php>Click here to login</a><br/>\n"; } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/195624-nothing-is-happens-when-i-click-submit-button/ 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.