Ok i created a form with the help of the tutorials you recomended.
Where in this code would i place my php code to check my database for a duplicate user id. Secondly where would i place my insert statement .Below you will see the form and my php/mysql code thanks
FORM
<HTML>
<HEAD>
<TITLE>EHP</TITLE>
</HEAD>
<BODY BGCOLOR=#FFFFFF>
<FORM ACTION="<?php echo $PHP_SELF; ?>" METHOD=POST>
<INPUT TYPE="hidden" NAME="action" VALUE="check">
<?php if($has_errors) { ?>
<FONT SIZE=4>Please Correct the Following Errors:</FONT><BR>
<UL>
<?php foreach($errors as $val) {
echo "<LI>$val</LI>";
}
?>
</UL>
<?php } else { ?>
Please fill out the fields below:<BR>
(required fields are marked with an *)<BR>
<?php } // End of $has_errors if ?>
<TABLE CELLPADDING=0 CELLSPACING=1 BORDER=0>
<TR>
<TD>First Name:</TD>
<TD><INPUT TYPE="text" NAME="EHPID" VALUE="<?php echo $HTTP_POST_VARS['EHPID']; ?>"></TD>
<TR>
<TD>Last Name:</TD>
<TD><INPUT TYPE="text" NAME="last" VALUE="<?php echo $HTTP_POST_VARS['last']; ?>"></TD>
<TD COLSPAN=2 ALIGN=CENTER><INPUT TYPE="submit" VALUE="Submit Form"></TD>
</TR>
</TABLE>
</FORM>
</BODY>
</HTML>
Code for database:
$mysql = mysql_connect('loca', 'eh', '9t') or exit(mysql_error());
mysql_select_db('ehpadmin') or exit(mysql_error());
$query2 = "SELECT * from test WHERE EHPID = '$EHPID '";
$result2 = mysql_query($query2) or exit(mysql_error());
if (mysql_num_rows($result2))
{
echo ' <script language = "javascript">
alert("You have already registered. Please try another EHPID")
</script>';
print '<meta http-equiv="refresh" content="0;URL=register2.html">';
}
The error checking above is in javascript. i want the error message to print on the form. Lastly where would the insert statement below go in the form code.
$query2 = "INSERT INTO test VALUES ('$user','$pass','$Last','$First','$Email','$EHPID')";
$result = mysql_query($query2) or exit(mysql_error());
echo ' Registeration Successful<br>
Click here to Login to the Online Customer Service System <a href ="main4.html">Login</a><br> ';
}