Im very impressed with this forum, first try all works and speedy response. Im trying to incorporate one more piece to this script.
i want to make sure someones EHPID is in my database in oder for them to register(this will prevent the whole world from registering. If their EHPID is not in my database then they cant register and a message box will appear. if it is in my database then it will just submitt like normal thanks for all help
here is the code im trying to use with the original code below it. i dont know where to place this code in original script thanks.
$name = $_POST['T2'];
$query ="select count(*) from mem where
EHPID ='$name'";
$result =mysql_query($query);
echo '<script language = "javascript">
alert("Your records are not in our system yet. Please Try Again at another time");
</script>';
print '<meta http-equiv="refresh" content="0;URL=register2.html">';
Original code
<?php
$mysql= mysql_pconnect('localhost','lllllllllllll','kkkkkkkkkk');
if(!$mysql)
{
echo'cannot connect to database';
exit;
}
$mysql=mysql_select_db('elllllllllll');
if(!$mysql)
{
echo'Cannont select database';
exit;
}
$name = $_POST['T2'];
$query ="select count(*) from mem where
EHPID ='$name'";
$result =mysql_query($query);
if(!$result)
{
echo'error';
exit;
}
$count = mysql_result($result,0,0);
if($count > 0)
{
$user=$HTTP_POST_VARS['username'];
$pass=$HTTP_POST_VARS['pass'];
$Last=$HTTP_POST_VARS['T3'];
$First=$HTTP_POST_VARS['T1'];
$Email=$HTTP_POST_VARS['T4'];
$EHPID=$HTTP_POST_VARS['T2'];
$conn = mysql_connect("localhost","ehpadmin","91see7hat");
mysql_select_db('ehpadmin');
$query="insert into test values ('$user','$pass','$Last','$First','$Email','$EHPID')";
$result=mysql_query($query);
echo'Registeration Successful</br>';
echo'Click here to Login to the Online Customer Service System<a href ="main4.html ">Login</a><br/>';
}
else
{
echo '<script language = "javascript">
alert("Your records are not in our system yet. Please Try Again at another time");
</script>';
print '<meta http-equiv="refresh" content="0;URL=register2.html">';
}
?>