How can I update_option in WordPress from this:
everything I do seems not to work; I must be missing something simple.
$l1teams = array(
1=>"Caterham-Renault",
2=>"Ferrari",
3=>"Force India-Mercedes",
4=>"HRT-Cosworth",
5=>"Lotus-Renault",
6=>"Marussia-Cosworth",
7=>"Mercedes GP",
8=>"Mclaren-Mercedes",
9=>"Red Bull-Renault",
10=>"Sauber",
11=>"Toro Rosso-Ferrari",
12=>"Williams-Renault",
);
<td><select name="league1_driver1_team"><?php foreach($l1teams as $team){?> <option value="<?php echo $l1d1t ?>"><?php echo $team ?></option> <?php } ?> </select></td>
I have all the other code setup correctly; I just cannot insert this value into the database in WordPress and echo it back out.
You are trying to echo
$l1d1tin your option tag which seems to be undefined in your example. You probably want something want to change your code to something like this:Essentially what I am doing is setting the array index to
$team_idand the array value to$team_name.