• Hi guys, i may be having a blonde moment here ??
    I am building a custom plugin, everything else is working how it should, but for some reason i cannot echo my “option”

    I have checked options.php and the field is infact there, but has no value.

    Here is some code ??

    My options array to populate the form <option>

    $l1dt = 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",
    		);

    Update and echo the options

    $l1d1t = $_POST['league1_driver1_team'];
    update_option('league1_driver1_team', $l1d1t);
    
    $l1d1t = get_option('league1_driver1_team');

    Now here is the form code:

    <td><select><?php foreach($l1dt as $key => $value) { ?><option value="<?php echo $l1d1t ?>"><?php echo $value ?></option><?php }?></select></td>

    ive just pasted the minimal as there is way too much to post here ??

    I want to update the option and return it as the <option> value.
    Any help would be fantastic.

    Many thanks in advance
    Rory

  • The topic ‘update_option from an array populated’ is closed to new replies.