Pass value through if statements
Posted: Sat Aug 12, 2006 9:24 pm
Im still working on a form to do account creation for a server im starting, and it uses a variety of if statements to pass form data, or atleast thats the idea.
For example:Takes the username and password and passes it to:
And on a successful verification of the ARK key (which is what the arkcheck if statement does, there is no user input in that statement), it automaticly redirects to the action continue which is supposed to put the information from the intiial form into a database. However it seems as if the data from the first form is lost during the movement through all of the if statements because the database never gets populated with the username, password, and email address (which is requested in the initial form that i didnt show you).
My question, how do you pass form information through multiple if statements so they are avalible 3-4 if statements later.
Thanks in advance
-Steve
For example:
Code: Select all
if($_GET['action'] == 'registered')
{
include('config.php');
$conn=@mysql_connect("$DBHOST", "$DBUSER", "$DBPASS")
or die("Err:Conn");
#select the specified database
$rs = @mysql_select_db("$DBNAME", $conn)
or die("Err:Db");
$result = mysql_query("SELECT * FROM verify
WHERE ip='{$_SERVER['REMOTE_ADDR']}'") or die(mysql_error());
$row = mysql_fetch_array( $result );
$ark = $row['ark'];
echo "<b>Your Account Creation Key (ARK) has been filled into the form, please continue registration.</b>";
echo "<b>Once you have recieved your ARK key in your email address, please fill out the rest of the form:</b><br>";
echo "<form method=\"post\" action=\"index.php?action=arkcheck\">ARK: <input type=\"text\" name=\"ark\" value=\"$ark\">
<br>Username: <input type=\"text\" name=\"username\">
<br>Password: <input type=\"text\" name=\"password\">
<br><input type=\"submit\" value=\"Finish\"></form>";
mysql_close();
}Code: Select all
if($_GET['action'] == 'arkcheck')
{
$ip = $_SERVER['REMOTE_ADDR'];
include('config.php');
$conn=@mysql_connect("$DBHOST", "$DBUSER", "$DBPASS")
or die("Err:Conn");
#select the specified database
$rs = @mysql_select_db("$DBNAME", $conn)
or die("Err:Db");
$result = mysql_query("SELECT * FROM verify
WHERE ip='{$_SERVER['REMOTE_ADDR']}'") or die(mysql_error());
$row = mysql_fetch_array( $result );
$ark = $_POST['ark'];
if($ark != $row['ark'])
{
echo "ARK does not match up with the database. Please click <a href=\"javascript: history.go(-1)\">here</a> to go back.";
exit();
}
else
{
echo "<SCRIPT LANGUAGE=\"JavaScript\">
window.location=\"index.php?action=continue\";
</script>";
}
}My question, how do you pass form information through multiple if statements so they are avalible 3-4 if statements later.
Thanks in advance
-Steve