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.

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.

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.