Hello,
I thought I'd start a new thread since my last one got a bit hectic. I've made a registration form where people sign up with username and password. The code I've used is:
CODE
$username = $_POST['username'];
$password = $_POST['password'];
$sql = "INSERT INTO users (username, password) VALUES ('".$username."', '".md5($password)."')";
mysql_query($sql)or die(mysql_error());
And the code for the form I've used is:
CODE
<form action="saveuser.php" method="post" >
<table>
<tr>
<td>Username</td>
<td><input type="text" name="username" id="uname_txt" /></td>
</tr>
<tr>
<td>Password</td>
<td><input type="password" name="password" id="pwd_txt" /></td>
</tr>
<tr>
<td></td>
<td><input type="submit" id="sub_btn" name="sub_btn" value="Submit" /></td>
</tr>
</table>
</form>
What i want to know is, if they've inputted an incorrect username or password (like too many characters or the username is taken), how can i redirect the user to a different page. I assume i have to use the header() function but I'm not sure how.
Thank you
This post has been edited by Sayid Ahmed: 23 Aug, 2008 - 05:33 AM