<?php
include("./include/db_connect.php");
$presql="select username from kuser";
$preresult=mysql_query($presql, $db);
/// check whether the required fields have been filled or not.
if(empty($username)||empty($password) ||empty($password1)||empty($name)||empty($mail))
{
header("Location: register.html?error=1");
exit;
}
elseif($preresult){
while($row=mysql_fetch_array($preresult))
{
if($username==$row['username'])
{
header("Location: register.html?error=2");
exit;
}
}
}//elseif end
elseif($password !=$password1) //check the passwords.
{
header("Location: register.html?error=3");
exit;
}
else {
//regist the user
}
in the register.html file it includes some php like
<?php
include("./menu.php");
switch ($error) {
case 1:
print "<FONT SIZE=\"4\" COLOR=\"#FF0066\">Please fill in the fields reqired...</font>";
break;
case 2:
print "<FONT SIZE=\"4\" COLOR=\"#FF0066\">The username is in use....</FONT>";
break;
case 3:
print "<FONT SIZE=\"4\" COLOR=\"#FF0066\">re-typed password is not matched</font>";
break;
}
?>
it checks
whether then username is in use,
whether required info is filled.
and
whether password and re-type password is matched.
but i sitll can't make it work
can anyone exam my code. appreciate in advanced...
i CAN redirect the user to the registration form if their fills are invalid.
such as username in use, password and re-type password mismatch and required fields unfilled.
yet now ...
i try to fill the registration form in a properly.
it just display a blank, can not regist the user.
if i disable all those if, elseif and else, then it is ok to register a user...
strange.....
thank you thank u thank u...