Jump to content

[SOLVED] Form Not Submitting


papillonstudios

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/168476-solved-form-not-submitting/
Share on other sites

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);

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.