Helmi_xisnet - 23 May 2007 05:36 AM
Hi Arden,
Thanks for dropping by.
No problem, what else should I be doing in the middle of the night? 
First: I can’t get {if option_value == rel_child_id}selected=“selected”{/if} to work; in fact nothing comes out on the page.
This happens from time to time. This doesn’t surprise me, since it’s in the query tags. Moving along…
Second: I’ve set PHP parsing to output, I can also echo {option_value},{rel_child_id} within the PHP code.
How can I detect a parsing error?
If you can echo the values with PHP, then you probably don’t have one. This should also give you a clue as to the fix for your problem: instead of assigning your EE tags to PHP variables, simply compare them direclty, like so:
{exp:weblog:entries weblog="books"}
<div id="container">
{exp:weblog:entry_form weblog="books"}{custom_fields}
{if relationship}
<select name="field_id_11">
{exp:query sql="SELECT rel_parent_id,rel_child_id FROM exp_relationships WHERE rel_parent_id='{segment_2}'"}
{options}<option value="{option_value}"{selected} <?php
if('{option_value}' == '{rel_child_id}') {
echo 'selected="selected"';
}
?>>{option_name}</option>{/options}
{/exp:query}
</select>
{/if}{/custom_fields}
{/exp:weblog:entry_form}
</div>
{/exp:weblog:entries}
Whitespace added for emphasis, feel free to condense. But yeah, this will probably work if you’re able to echo the values directly.
Third: Changing positions for rel_parent_id and rel_child_id doesn’t do anything.
I’m not particularly surprised, I didn’t expect it would.