Feb 9th, 2011, 7:51 PM
Hi sogreen,
So just so I understand: the dropdown code that you posted is working okay, you just need it to set the appropriate value in the dropdown?
If that's the case, you're almost done. You'll just need to add something like this:
.. and replace "$THEVALUE" with whatever variable contains the value for that field.
Hope this helps a bit. If I misunderstood, post me back.
- Ben
So just so I understand: the dropdown code that you posted is working okay, you just need it to set the appropriate value in the dropdown?
If that's the case, you're almost done. You'll just need to add something like this:
PHP Code:
<?php
$result = @mysql_query("select option_value,option_name from database.ft_field_options where field_group_id='1');
print "<select name='category'>\n";
while ($row = mysql_fetch_assoc($result)){
$value = $row['option_value'];
$name = $row['option_name'];
$selected = ($row['option_value'] == $THEVALUE) ? " selected" : "";
print "<option value=$value{$selected}>$name</option>\n";
}
print "</select>\n";
?>
.. and replace "$THEVALUE" with whatever variable contains the value for that field.
Hope this helps a bit. If I misunderstood, post me back.
- Ben