0

I'm trying to get my form to select its choices from a predefined mysql array (field_5806395ec1f8d)

Somehow I keep getting nasty T_STRING errors, but I can't figure out why.

(It's all wrapped in an endcontent variable btw)

<div class="xxx">
  <input type="text" id="select3" class="jsselect" placeholder="choose" value="'.$_POST[radio3].'">

  <div class="popup_select" id="select_div3"> $field = get_field_object("field_5806395ec1f8d");
    $i=2;
    foreach($field[choices] as $select){
    echo '
        <input id="select3_'.$i.'" onclick="radio(\''.$select.'\',3);this.form.submit();" name="radio3" value="'.$select.'" type="radio" '.($_POST[radio3] == $select ? "checked" : "").'>
        <label for="select3_'.$i.'">'.$select.'</label>
        <br>
    ';
    $i++;
    } 
  </div>

</div>

Any help will be gladly appreciated. Thank you.

paul-shuvo
  • 1,874
  • 4
  • 33
  • 37
GrampaRay
  • 170
  • 1
  • 13

1 Answers1

0

A few mistooks in there and I'm not sure I've spotted them all but perhaps this might help? Field names in the POST array need to be quoted btw

echo '
<div class="xxx">
  <input type="text" id="select3" class="jsselect" placeholder="choose" value="'.$_POST["radio3"].'">

  <div class="popup_select" id="select_div3">';

    $field = get_field_object("field_5806395ec1f8d");
    $i=2;
    foreach($field["choices"] as $select){
    echo '
        <input id="select3_'.$i.'" onclick="radio(\''.$select.'\',3); this.form.submit();" name="radio3" value="'.$select.'" type="radio" '.($_POST["radio3"] == $select ? "checked" : "").' />
        <label for="select3_'.$i.'">'.$select.'</label>
        <br>';
    $i++;
    }
echo '
  </div>
</div>';
Professor Abronsius
  • 33,063
  • 5
  • 32
  • 46