I have a form which contains a dropdown list of countries generated from database. When edit button is clicked all the form values get fetched from database. What i require is that when edit is clicked the selected option of the database must be that stored in the corresponding database. Here is my code i tried.\[code\] $selected = $list["country_country_name"]; <tr><td>Country</td><td><select onchange="getCountry(this.value);" name="country" id="country" ><?php foreach( $query as $qry ) { print '<option value="'.$qry["country_country_name"].'"'; if( $qry["country_country_name"] == $selected ) print'selected'; print '>'.$qry["country_country_name"].'</option>'."\n";} ?></select><?php echo form_error('country'); ?></td></tr>\[/code\]