I'm coding a system where a user can login and update their info. I'm new to sessions, so please bear with me. Here is the code:
<?php
dbConnect("xs");
$sql = "SELECT st FROM states";
$result = mysql_query($sql);
if (!$result) {
error('A database error occurred');
}
else{
$state = "SELECT state FROM client WHERE userid = '$_SESSEION[userid]' ".
" AND password = '$_SESSION[password]'";
$resultstate = mysql_query($state);
echo "<select name='state'><option value=\"\">$resultstate";
while ($rows=mysql_fetch_array($result)){
$option=$rows['st'];
echo "<option value=\"$option\">$option";
}//end while
}
?>
I'm trying to display a dropdown menu with a list of states. The dropdown is working fine, its what is displayed in the dropdown before clicking it that is confusing me. When the page is displayed, instead of the dropdown saying "Georgia" (which is the state in the database for the current user), it says "Resource ID #11". I noticed that "Georgia" is the 11th state in the state table, but why doesn't it just display "Georgia"?
Thanks for any ideas!