I just finished this script it works well, but I am struggling to pass along the $invite variable to the register.php page. Can someone please tell me how I can achieve this? I have it defined as $invite = $_POST['inviteinput'];
How do I get the users input from index.php to transfer to register.php? Thank you for your help!
HTML FORM:
<form action="index.php" method="post">
What is your Invite Code?<BR />
<input class="textbox" name="inviteinput" type="text" />
<BR />
<input type="hidden" name="formsubmitted" value="TRUE" />
<input name="Submit" type="submit" value="Verify" />
</form>
PHP:
<?PHP
include ('scripts/dbconnect.php');
if (isset($_POST['formsubmitted'])) {
if (empty($_POST['inviteinput'])) {
echo '<div class="errormsgempty"><u>ERROR</u>:<br>You must enter a valid invite code to proceed!</div>';
} else {
$invite = $_POST['inviteinput'];//else assign it a variable
$invite = stripslashes($invite);
$invite = mysql_real_escape_string($invite);
$sql = "SELECT yourMemberId FROM Register WHERE yourMemberId='$invite'";
$result = mysql_query($sql);
if(mysql_num_rows($result) > 0) {
echo '<META HTTP-EQUIV="Refresh" Content="0; URL=register.php">';
} else {
echo '<div class="errormsgbox"><u>ERROR</u>:<br>The Invite Code you entered ' . $invite . ' is NOT a valid invite code!</div>';
//($notvalidcode = "The Invite Code you entered <strong>" . $invite . "</strong> is NOT a valid invite code!");
}
}
}
?>