I’m using this code in my SAEF; to auto select options that is related to the current entry_id:
<select name="field_id_11">
{exp:query sql="SELECT rel_child_id FROM exp_relationships WHERE rel_parent_id='{segment_2}'"}
{options}<option value="{option_value}"{selected} <?php $option = "{option_value}"; $child = "{rel_child_id}"; if($option == $child) {
echo 'selected="selected"';
} ?>>{option_name}</option>{/options}
{/exp:query}
</select>
I can echo both {option_value} and {rel_child_id} within my PHP code. But when I’m using IF statement, it fails.
I’ve tried to set PHP parsing to In and Out without success. Pls help.
