Sorry i had this whole site working before and then i had to format my HD and lost it and i found some code i posted on here a while back. It worked then but now i am getting this on the page when i look at it:
0) { echo "Sorry username taken. Please TRY AGAIN."; } else { $db = mysql_connect("localhost", "root"); mysql_select_db("register",$db); $sql = "INSERT INTO members (username, password, sec_que, sec_answer, bmon, bday, byear, fname, lname, zip, gender, email) VALUES ('$username','$password','$sec_que','$sec_answer', '$bmon',$bday,$byear,'$fname','$lname',$zip,'$gend er','$email')"; $result = mysql_query($sql); echo "Thank you for signing up $fname.\n
Now please login!
"; }//end username check }//Email Check else { echo "Invalid e-mail, try again"; } }//Passwords not matching }//ends the else statement for username and password not being 6 chars }//Closes if statement for $submit else { // display form before submit button is clicked ?>
Here is my code maybe you see something i dont:
<html>
<head>
<title>Register</title>
</head>
<body vlink="#c0c0c0">
<?php
if ($submit)
{
if (strlen($username) < 6 || strlen($password) < 6)
{
echo "Username and Password must be atleast 4 characters.\n";
}
else
{
if ($password != $password2)
{
echo "Your passwords did not match!!!!";
}
else
{
if
(ereg("^([0-9,a-z,A-Z]+)([.,_]([0-9,a-z,A-Z]+))*[@]([0-9,a-z,A-Z]+)([.,_,-]([0-9,a-z,A-Z]+))*[.]([0-9,a-z,A-Z]){2}([0-9,a-z,A
-Z])?$", $email))
{
// process form when submit is clicked
$db = mysql_connect("localhost", "root");
mysql_select_db("register",$db);
$lqs = "SELECT username FROM members WHERE username = '$username'";
$tluser = mysql_query($lqs);
if (mysql_num_rows($tluser) > 0)
{
echo "Sorry username taken. Please <a href='register.php'>TRY AGAIN</a>.";
}
else
{
$db = mysql_connect("localhost", "root");
mysql_select_db("register",$db);
$sql = "INSERT INTO members (username, password, sec_que, sec_answer, bmon, bday,
byear, fname, lname, zip, gender, email) VALUES ('$username','$password','$sec_que','$sec_answer',
'$bmon',$bday,$byear,'$fname','$lname',$zip,'$gend
er','$email')";
$result = mysql_query($sql);
echo "Thank you for signing up $fname.\n<h3>Now please <a
href='login.php'>login</a>!</h3>";
}//end username check
}//Email Check
else
{
echo "Invalid e-mail, try again";
}
}//Passwords not matching
}//ends the else statement for username and password not being 6 chars
}//Closes if statement for $submit
else
{
// display form before submit button is clicked
?>
<form name="register" method="post" action="<?php echo $PHP_SELF?>">
<h3><b>Login Information</b></h3>
<hr>
<h4>Username:<b>*</b></h4><input type="text" name="username">
<h4>Password:<b>*</b></h4><input type="password" name="password">
<h4>Re-type Password:</h4><input type="password" name="password2">
<br>
<b><h5>(* Must be atleast 6 characters long.)</h5></b>
<br>
<hr>
<br>
<h3><b>Security Information</b></h3>
<br>
<h5>If you forget your password or need help with your account, you will need this information to recieve support.</h5>
<h4>E-Mail:</h4><input type="text" name="email">
<br>
<h4>Security Question:</h4>
<select name="sec_que">
<option value="what city were you born in?">What city were you born in?
<option value="Who was your childhood hero?">Who was your childhood hero?
<option value="What make was your first car?">What make was your first car?
</select>
<br>
<h4>Your answer:</h4><input type="text" name="sec_answer">
<br>
<h4>Birthday:</h4>
<select name="bmon">
<option value="January">January
<option value="February">February
<option value="March">March
<option value="April">April
<option value="May">May
<option value="June">June
<option value="July">July
<option value="August">August
<option value="September">September
<option value="October">October
<option value="November">November
<option value="December">December
</select>
<input type=text name="bday" value="" size=2 maxlength=2> ,
<input type=text name="byear" value="" size=4 maxlength=4 > (Month DD, YYYY)
<br>
<br>
<hr>
<br>
<h3><b>Personal Information</b></h3>
<br>
<br>
<h4>First Name:</h4><input type="text" name="fname">
<h4>Last Name:</h4><input type="text" name="lname">
<h4>Zip Code:</h4><input type="text" name="zip">
<h4>Gender:</h4>
<select name="gender">
<option value="male">Male
<option value="female">Female
</select>
<br>
<br>
<input type="Submit" name="submit" value="Submit">
<input type="Reset" name="reset" value="Reset">
</form>
<?php
} //ends the else statement for $submit
?>
</body>
</html>
[code=php]