Hi, I have the codes below, for a form but when I click to register it goes to the blank.php page on wich says the the form is no complete, but that happens even if I fill all the fields, and since I have some JS there as well, I don't know where is the problem, it was working before but now, I don't know, here is the page:
<?php
// Connects to your Database
mysql_connect("******", "*****", "******") or die(mysql_error());
mysql_select_db("*****") or die(mysql_error());
//This code runs if the form has been submitted
if (isset($_POST['submit'])) {
//This makes sure they did not leave any fields blank
// if (!$_POST['name'] | !$_POST['username'] | !$_POST['pass'] | !$_POST['pass2'] | !$_POST['email'] | !$_POST['email2'] ) {
if ($_POST['name'] != 'Name' | $_POST['username'] != 'Username' | $_POST['pass'] != 'Password' | $_POST['pass2'] != 'Password conf.' | $_POST['email'] != 'E-mail' | $_POST['email2'] != 'E-mail' ) {
die ("<meta http-equiv=\"refresh\" content=\"0; url=blank.php\">");
}
//test to see if username is alpha-numeric
$test= $_POST['username'];
if (!eregi("([^A-Za-z0-9])",$test)){
}else{
die ("<meta http-equiv=\"refresh\" content=\"0; url=alphan.php\">");
}
// checks if the username is in use
if (!get_magic_quotes_gpc()) {
$_POST['username'] = addslashes($_POST['username']);
}
$usercheck = $_POST['username'];
$check = mysql_query("SELECT username FROM users WHERE username = '$usercheck'")
or die(mysql_error());
$check2 = mysql_num_rows($check);
//if the usernamename exists it gives an error
if ($check2 != 0) {
die ("<meta http-equiv=\"refresh\" content=\"0; url=usedname.php\">");
}
// ckeck if the email already exists
if (!get_magic_quotes_gpc()) {
$_POST['email'] = addslashes($_POST['email']);
}
$emailcheck = $_POST['email'];
$echeck = mysql_query("SELECT email FROM users WHERE email = '$emailcheck'")
or die(mysql_error());
$check3 = mysql_num_rows($echeck);
//if the email exists it gives an error
if ($check3 != 0) {
die ("<meta http-equiv=\"refresh\" content=\"0; url=usedemail.php\">");
}
//this makes sure both passwords entered match
if ($_POST['pass'] != $_POST['pass2']) {
die ("<meta http-equiv=\"refresh\" content=\"0; url=pwmatch.php\">");
}
// this checks if both emails match
if ($_POST['email'] != $_POST['email2']) {
die ("<meta http-equiv=\"refresh\" content=\"0; url=emailmatch.php\">");
}
// here we encrypt the password and add slashes if needed
//$_POST['pass'] = md5($_POST['pass']);
if (!get_magic_quotes_gpc()) {
//$_POST['name'] = addslashes($_POST['name']);
$_POST['username'] = addslashes($_POST['username']);
$_POST['pass'] = addslashes($_POST['pass']);
$_POST['email'] = addslashes($_POST['email']);
}
// now we insert it into the database
$insert = "INSERT INTO users (name, username, email, password)
VALUES ('".$_POST['name']."', '".$_POST['username']."', '".$_POST['email']."', '".$_POST['pass']."')";
$add_member = mysql_query($insert);
die ("<meta http-equiv=\"refresh\" content=\"0; url=reg.php\">");
}
else
{
?>
<html>
<title> DHP Registration</title>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<link type="image/x-icon" href="images/icon.jpg" rel="shortcut icon">
<link type="text/css" href="menu.css" rel="stylesheet" />
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript" language="javascript">
function changefield(){
document.getElementById("passwordbox").innerHTML = "<input id=\"password-field\" type=\"password\" name=\"pass\" title=\"Password\" tabindex=\"2\" />";
document.getElementById("passwordbox2").innerHTML = "<input id=\"password-field2\" type=\"password\" name=\"pass2\" title=\"Password\" tabindex=\"2\" />";
document.getElementById("password-field").focus();
document.getElementById("password-field2").focus();
}
</script>
<link rel="stylesheet" href="style.css" type="text/css" />
</head>
<!-- BODY -->
<body style="margin:0px 0px 0px 0px;">
<!-- HEAD -->
<div align="center">
<div style="background:#b5ae63 repeat-x; width:1100px; height:168px;">
<img class="head" src="images/douglogo2.png" />
<!--img src="images/header_doug.png" width="1000px" height="168px" alt=""-->
<span class="text3">Welcome!</span>
<?php
$months =array(1 =>"January",
2=>"February",
3=>"March",
4=>"April",
5=>"May",
6=>"June",
7=>"July",
8=>"August",
9=>"September",
10=>"October",
11=>"November",
12=>"December");
$today = getdate();
$day = $today["mday"];
$month = $today["mon"];
$nameMon = $months["$month"];
$year = $today["year"];
echo "<span class='text3' style='margin:145px 0px 0px 100px;'>$nameMon,$day $year.</span>";
?>
</div>
<!-- Body info-->
<div style=" background:#122547; width:1100px;">
<!-- MENU -->
<div align="left">
<div id="menu" style="width:350px; height:51px;">
<ul class="menu">
<li><a href="#" class="parent"><span>Home</span></a></li>
<li><a href="#" class="parent"><span>About Us</span></a>
<div>
<ul>
<li><a href="#" class="parent"><span>About DHP</span></a>
<div>
<ul>
<li><a href="#"><span>History</span></a></li>
<li><a href="#"><span>Our Goal</span></a></li>
</ul>
</div>
</li>
<li><a href="#" class="parent"><span>Specials</span></a>
<div>
<ul>
<li><a href="#"><span>Signup for discounts</span></a></li>
<li><a href="#"><span>Specials of the week</span></a></li>
</ul>
</div>
</li>
</ul>
</div>
</li>
<li><a href="#"><span>Services</span></a>
<div>
<ul>
<li><a href="#" class="parent"><span>Residential</span></a>
<div>
<ul>
<li><a href="#"><span>Faux Finishing</span></a></li>
<li><a href="#"><span>Crown molding</span></a></li>
<li><a href="#"><span>New projects</span></a></li>
</ul>
</div>
</li>
<li><a href="#"><span></span></a></li>
<li><a href="#" class="parent"><span>Commercial</span></a>
<div>
<ul>
<li><a href="#"><span>C.1</span></a></li>
<li><a href="#"><span>C.2</span></a></li>
</ul>
</div>
</li>
</ul>
</div>
</li>
<li class="last"><a href="#"><span>Contact Us</span></a></li>
</ul>
</div>
</div>
<!-- LOGIN FORM -->
<br/>
<!-- SLIDESHOW -->
<div align="center" style="border:#ffffff solid 0px; width:250px; height:200px; margin:70px 0px 0px 100px;">
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<div>
<input class="form-box" type="text" name="name" value="Name" onfocus="if(this.value == 'Name') { this.value = ''} "
onblur="if(this.value == '') { this.value='Name'; }" />
</div>
<div>
<input style="color:#122547; background-color:#b5ae63; border-radius:5px;" type="text" name="username" value="Username" onfocus="if(this.value == 'Username') { this.value = ''} "
onblur="if(this.value == '') { this.value='Username'; }" />
</div>
<div>
<input style="color:#122547; background-color:#b5ae63; border-radius:5px;" type="text" name="email" value="E-mail" onfocus="if(this.value == 'E-mail') { this.value = ''} "
onblur="if(this.value == '') { this.value='E-mail'; }" />
</div>
<div>
<input style="color:#122547; background-color:#b5ae63; border-radius:5px;" type="text" name="email2" value="E-mail" onfocus="if(this.value == 'E-mail') { this.value = ''} "
onblur="if(this.value == '') { this.value='E-mail'; }" />
</div>
<div id="passwordbox">
<input style="color:#122547; background-color:#b5ae63; border-radius:5px;" onFocus="if(this.type == 'text'){ this.value=''; this.type = 'password';}" onBlur="if(this.value== ''){ this.value='Password'; this.type = 'text';}" value="Password" name="pass" />
</div>
<div id="passwordbox2">
<input style="color:#122547; background-color:#b5ae63; border-radius:5px;" onFocus="if(this.type == 'text'){ this.value=''; this.type = 'password';}" onBlur="if(this.value== ''){ this.value='Password'; this.type = 'text';}" value="Password" name="pass2" />
</div>
<br/>
<div align="center"><input class="loginb" style="width:70px" type="submit" name="submit" value="Register">
<input class="loginb" type="reset" name="reset" value="Clear">
</div>
</form>
</div>
<br/>
<br/>
<br/>
<!-- FOOTER -->
<p class="footer" align="left"> |Sitemap|
<div style="border:#ffffff solid 0px; margin-top:250px;" id="copyright"><br/>Copyright © 2011 <a href="http://apycom.com/">Apycom jQuery Menus</a></div></p>
</div>
</div>
</div>
</body>
</html>
<?php
}
?>