Echo the selected option from an array populated select form

I am building a custom plugin and have all my code sorted, my data is being saved into the database and I can retrieve it, but two things are confusing me.

1, when I echo back the saved data from the array populated form, I receive just! the index numbers and none of the values….

Read More

2, my array is in a drop-down form; how can I retrieve the data from the database and echo it as the “selected” option?

<td><select name="league1_driver1_team"><?php foreach($l1teams as $team_id => $team_name){?> <option <?php selected( $l1d1t, 1 ); ?> value="<?php echo $team_id; ?>"><?php echo $team_name ?></option> <?php } ?> </select></td>

Related posts

Leave a Reply