Below are excerpts from two PHP scripts that I am working on. What I am wanting to do is determine if the $UserName variable exists in the database tables "California" and "NewYork". If the $UserName variable is present on the first iteration the script will output "UserName is in this table!" and so forth for each iteration.
I can't get the scripts below to work. Does anybody see what I am doing wrong?
//---------------- Login.php ----------------
echo "<form action=\"AdminPage.php\" method=\"post\">";
echo "Click Below To Proceed";
echo "<input type=\"hidden\" name=\"Textfield\"" . "[$California]" .">";
echo "<input type=\"hidden\" name=\"Textfield\"" . "[$NewYork]" .">";
echo "<input type=\"submit\" value=\"Click Here\"></form>";
//----------------- AdminPage.php ----------
$UserName = "pete1";
require "../quote/conf/config.inc.php";
foreach( $_POST['Textfield'] as $Key=>$Table )
{
$Query = "SELECT * FROM $Table WHERE UserName = '$UserName'";
$Result = mysql_db_query ($db_info[dbname], $Query, $db_connection);
// Fetch the results from the database.
while ($Row = mysql_fetch_array($Result)){
if ($Row["UserName"]){
echo "UserName in this table!";
}
}
}
Thanking you in advance.
Volitics