Could somebody please advise me on the following (and bear with me...Im a newbie)
I was trying out this code for a dependant drop down list for country and state from this site:
It works fine but when I use php to put selected options in the mysql tables I created and display the outcome it displays the country and state code and not the actual name.(for example: I select United Sates and Texas it will display US and TX instead of the whole name, so its saving the codes instead of the names) Im sure I am doing something small wrong but thats what you get for being a newb! I have tried to break down my code as much as possible and maybe somebody could help me in the right direction.
this is the code on my page that creates the list boxes and it shows up fine:
<td height="21" colspan="2" valign="top"><font color="#FF0000" size="1">Please
select your country/state</font> <font color="#FF0000">*</font></td>
<td height="27" valign="top">
<select id='countrySelect' name='country' class="required" onchange='populateState()'>
<select id='stateSelect' name='state'>
Then I have this php to send it to mysql table (I am not including the whole page, just the php related to this problem):
mysql_query("UPDATE users SET
`country` = '$_POST[country]',
`state` = '$_POST[state]',
") or die(mysql_error());
On the profile page it displays it with this php:
$result = mysql_query("select * from users where id='$_SESSION[user_id]'");
//grab all the content
//the format is $variable = $r["nameofmysqlcolumn"];
//modify these to match your mysql table columns
//display the row
echo " <br> $country <br> $state <br> ";
There is a row in the mysql table called country, varchar(200), not null
and the same for state called state.
Appologies in advance for the long post but I thought I better add all details I might need.
Thanks again for your time.