Forum Moderators: coopster

Message Too Old, No Replies

How can I solve my Problem?

I have a 1 table with 8 feilds in mysql...

         

Knowledge seeker

6:19 pm on Oct 16, 2009 (gmt 0)

10+ Year Member



I have a 1 table with 8 feilds in mysql, all of feidls values are echo in a form for taking information from the visitor using php 4+, which ever feilds i want to take from the this table is displaying properly, but their is one feild which is actually a drop down menu is not showing the value as I should retrieved it from the database, it display the Ist value of the feild, i.e I have country list
Afghnistan,Albania, Austria,......US,UK, and so on, if I want to display US, it will by automatically display the Afghanistan.
I am new to this forum if there is any difficulty to understand my question, please pardon me..
waiting for your sincer response.

Pico_Train

4:37 pm on Oct 18, 2009 (gmt 0)

10+ Year Member



this this:

Let's say $retrieved is your array of data retrieved from your db.

<select name="country" id="country">
<?php foreach ($country as $c){?>
<option value="<?php echo $c['country_id'];?>"
<?php if(isset($retrieved['country_id']) && $retrieved['country_id'] == $c['country_id']) echo "selected = 'selected'";?>
><?php echo ucwords($c['country']);?></option>
</select>