0

Please I have a problem. I have a list of countries in my database. After someone completes filling a form which is then stored in the database, the value for a country appears in the database instead of the country name. For example ,when some selects England from a list ,Instead of the name England appearing in the database its value appears like 24. I used the drop down menu in doing this.

3
Contributors
2
Replies
3
Views
9 Years
Discussion Span
Last Post by ProfessorPC
0

It would help to have some sample code but I would assume that your dd list looks something like this

<select name="selCountry">
<option value="24">Country Name 1</option>
<option value="25">Country Name 2</option>
</select>

in this case in a post $_POST would equal the selected "value" of the dd list and that is what would be posted to the database. If your database is set up in normal form this would be correct because that would then refer to the primary key of the countries table. If you want the actual country name stored in the inserted record then you will probably want to put the country name in the value attribute of the <option> tag.

0

or when you pull the info you could leave the country id and do a join in your query to pull the name from that id.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.