papillonstudios Posted August 2, 2009 Share Posted August 2, 2009 This form is not submitting and i have looked at the code and i cant find anything. <?php include ('defs.php'); if (!defined('error_check')) die('You Cannot Access This Page From This Location'); //If the form hasn't been submitted, show it. if (!isset($_POST['post'])) { ?> <h3>Step 3 - Create Admin User</h3> <form action action="index.php?step=step3" method="post"> <table width="75%"> <tr><td>Username </td><td><input type="text" class="input" name="username" /></td></tr> <tr><td>Password </td><td><input type="password" class="input" name="password" /></td><td><input type="password" class="input" name="cpassword" /></td></tr> <tr><td>Email </td><td><input type="text" class="input" name="email" /></td></tr> <tr><td><input type="submit" class="input" name="submit" value="Create Account" /></td></tr> </table> </form> <?php } //Or else it has been submitted... else { //Get information from the forms secure it all. $username = secure($_POST['username']); $password = secure($_POST['password']); $cpassword = secure($_POST['cpassword']); $email = secure($_POST['email']); //Get their IP Address $ip = secure($_SERVER['REMOTE_ADDR']); //And the time they signed up $signup = time(); //If anything is empty... if (!$username | !$password | !$cpassword | !$email) { echo '<img src="i/warning.png" alt="warning">eek! please fill all fields!!'; } else { //If the passwords dont match if ($password != $cpassword) { echo 'The passwords do not match'; } else { //If the email they entered wasn't an authentic email.. if (!isEmail($email)) { echo "You didn't enter a valid email address"; } else { //Encrypt the password $encpass = sha1($password . SALT); $connect = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD); if (!connect) { die('Could not connect: ' . mysql_error()); } $selectdb = mysql_select_db(DB_NAME); if (!$selectdb) { die('Could not Select DB: ' . mysql_error()); } $admin = "INSERT INTO `users` (username, password, email, ip, signup, membergroup) VALUES ('$username', '$encpass', '$email', '$ip', '$signup', 'admin')"; $aemail = "INSERT INTO `info` (aemail) VALUES ('$email')"; mysql_query($admin) or die ('Couldn\'t insert Data' . mysql_error()); mysql_query($aemail) or die ('Couldn\'t insert Data' . mysql_error()); //If the insert went ok... if (mysql_query('$admin, $aemail')) { //Tell them their user info echo 'Success, you are now registered<br />'; echo 'You can now login using the following information<br /><br />'; echo "Username: <strong>$username</strong><br />"; echo "Password: <strong>$password</strong><br />"; echo "Login <a href='index.php?action=login'>Go</a>"; } else { echo 'Error, user not added'; } } } } } ?> Thanks in Advance peeps Quote Link to comment https://forums.phpfreaks.com/topic/168476-solved-form-not-submitting/ Share on other sites More sharing options...
Maq Posted August 2, 2009 Share Posted August 2, 2009 You're checking if a field named 'post' is being submitted, I think it should be 'submit'. Quote Link to comment https://forums.phpfreaks.com/topic/168476-solved-form-not-submitting/#findComment-888712 Share on other sites More sharing options...
papillonstudios Posted August 2, 2009 Author Share Posted August 2, 2009 i added this line to the form <input type="hidden" value="1" name="post" /> and will this work for the password encryption? //Encrypt the password $shuffler = ''.$username.''.$cpassword.''; $salt = str_shuffle($shuffler); $encpass = sha1($password . $salt); Quote Link to comment https://forums.phpfreaks.com/topic/168476-solved-form-not-submitting/#findComment-888716 Share on other sites More sharing options...
Maq Posted August 2, 2009 Share Posted August 2, 2009 Where does this POST come from? if (!isset($_POST['post'])) { Are you submitting information from another page to this one? Quote Link to comment https://forums.phpfreaks.com/topic/168476-solved-form-not-submitting/#findComment-888719 Share on other sites More sharing options...
papillonstudios Posted August 2, 2009 Author Share Posted August 2, 2009 it checks if the form has been submitted but i forgot the line i posted in my previous post. So when the form is submitted the it doesn't show the form and does what ever so is i went like this <?php include ('defs.php'); if (!defined('error_check')) die('You Cannot Access This Page From This Location'); //If the form hasn't been submitted, show it. if (!isset($_POST['post'])) { ?> <h3>Step 3 - Create Admin User</h3> <form action action="index.php?step=step3" method="post"> <input type="hidden" value="1" name="post" /> <table width="75%"> <tr><td>Username </td><td><input type="text" class="input" name="username" /></td></tr> <tr><td>Password </td><td><input type="password" class="input" name="password" /></td><td><input type="password" class="input" name="cpassword" /></td></tr> <tr><td>Email </td><td><input type="text" class="input" name="email" /></td></tr> <tr><td><input type="submit" class="input" name="submit" value="Create Account" /></td></tr> </table> </form> <?php } //Or else it has been submitted... else { echo 'User Created'; ?> When you click the button it would show the test "User Created" and not the form Quote Link to comment https://forums.phpfreaks.com/topic/168476-solved-form-not-submitting/#findComment-888724 Share on other sites More sharing options...
Maq Posted August 3, 2009 Share Posted August 3, 2009 You have marked this as solved, but your post seems as though you're still having an issue. Which is it? Quote Link to comment https://forums.phpfreaks.com/topic/168476-solved-form-not-submitting/#findComment-889615 Share on other sites More sharing options...
papillonstudios Posted August 5, 2009 Author Share Posted August 5, 2009 i got it fixed i forgot a hidden field in the form ro update "post" with the value 1 so that the if statement works. Quote Link to comment https://forums.phpfreaks.com/topic/168476-solved-form-not-submitting/#findComment-891692 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.