hi, im trying to make a php register form, everything seams to work fine, but nothing is added to the database, but i get no errors. u can see it here for yourself:
http://kontent.co.uk/clipboard/register.html
here is my code
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>clipboard</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<?php
if($firstName && $lastName && $email && $username && $password && $password2){ //all fields filled in
if($password == $password2){ // passwords match
if(strlen($password) >= 6){ // password is greater than or equal to 6 chars
$link = mysql_connect("localhost", "****", "****");
mysql_select_db("BellR", $link);
$result = mysql_query("select * from userTable where username = '$username'");
if (mysql_num_rows($result) == 0){
$regQuery = "insert into userTable (username, password, firstName, lastName, email) values ('$username', '$password', '$firstName', '$lastName', '$email')";
mysql_query(regQuery);
$message = "Welcome $username. Your account has been succesfully created. Continue to <a href='login.html'>log in</a>";
}
else{
$message = "That username is already in use. Press back and try another.";
}
mysql_close ($link);
}
else{
$message = "Password must be at least 6 characters. Press back and change it.";
}
}
else{
$message = "The passwords you entered did not match. Press back and change them.";
}
}
else{
$message = "You did not complete the form. Press back and fill in all fields.";
}
?>
<body>
<table class="centerTable"><tr><td align="center" valign="middle">
<table border="0" cellpadding="0" cellspacing="0" class="mainTable">
<tr>
<td class="titleBar"> </td>
</tr>
<tr>
<td class="content">
<p><?php print $message ?></p>
</td>
</tr>
<tr>
<td class="bottomBar"> </td>
</tr>
<tr>
<td><p class="footerText">clipboard © robert bell 05</p></td>
</tr>
</table>
</td></tr></table>
</body>
</html>
thanks for any help
john