ok...
Posted: Mon Mar 15, 2004 8:39 pm
Well thanks for the script... i will try it, and as for what my script is... here it is.....
display.php
register.php
That's my code!!! but i'm confused... ok i have the database, and the table... but the information that is entered does not save to the table.. am i missing something?
?>
display.php
Code: Select all
<form action="register.php" method="post">
<table>
<tr>
<td>Name</td>
<td><input type="textfield" name="txtName"></td>
</tr>
<tr>
<td>Password</td>
<td><input type="password" name="txtPassword"></td>
</tr>
<tr>
<td colspan="2">
<input type="submit" value="Register">
</td>
</tr>
</table>
</form>Code: Select all
<?php
$dbh=mysql_connect ("localhost", "equestra_test", "password") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("equestra_members");
$username = $HTTP_POST_VARSї'txtName'];
$password = $HTTP_POST_VARSї'txtPassword'];
$rs = mysql_query("SELECT * FROM myUsers WHERE Name = '$username' AND Password = '$password' ");
//if the user exists
if (mysql_num_rows($rs)>0)
{
echo("The user already exists, please try again");
}
else
{
//the user does not exist set him into the user table
$sql = mysql_query("INSERT INTO myUsers VALUES ( '$username', '$password' ) ");
echo("You have registered");
} ?>?>