Hi, I just need help with comparing a form variable to a variable in a database and displaying the information for that user if the username and password is correct.
This is what I have so far...I just need an example of how to compare and match the variables, then display relavent data.
It doesn't have to be all in this one script either. Thanks in advance.
<?php
$sql = "SELECT * FROM characters";
$dbaddress = "localhost";
$dbuser = "user";
$dbpass = "pass";
$dbname = "db";
$db = mysql_connect($dbaddress, $dbuser, $dbpass) or die("Could not connect: " . mysql_error());
mysql_select_db($dbname,$db);
$result = mysql_query($sql, $db);
if ($submit) {
// process form
printf("Character Name: %s<br>\n", mysql_result($result,0, "cName"));
printf("Empire: %s<br>\n", mysql_result($result,0, "cEmpire"));
printf("Rank: %s<br>\n", mysql_result($result,0, "cRank"));
printf("Outfit: %s<br>\n", mysql_result($result,0, "cOutfit"));
} else {
mysql_close($db);
?>
<form method="post" action="<?php echo $PHP_SELF ?>">
<input type="text" name="txtUser">
<input type="text" name="txtPass">
<input type="Submit" name="submit">
</form>
<?php
}
?>