Jump to content

Default option in Drop-down. How?


Pi_Mastuh

Recommended Posts

one more example then:
<?php function select($pm, $type){if ($pm == $type) echo "selected=\"selected\"";}?>
<option value="inbox" <?php select($pm, "inbox");?>>Inbox</option>
<option value="outbox" <?php select($pm, "outbox");?>>Outbox</option>
regular would look this:
<option value="xx" selected="selected">Standard</option>
<option value="thumbup">Thumb Up</option>
So I would have:
[code]<select name='avatar'>
<?php function select($avatar, $type){if ($avvie == $type) echo "selected=\"selected\"";}?>
<option value="avatar.php?avatar=avatar1" <?php select($avatar, "avatar1");?>>avatar1</option>
<option value="avatar.php?avatar=avatar2" <?php select($avatar, "avatar2");?>>avatar2</option>
<option value="avatar.php?avatar=avatar3" <?php select($avatar, "avatar3");?>>avatar3</option>[/code]
etc?
[code]
<select name='avatar'>
<?php function select($avatar, $type){if ($avatar == $type) echo "selected=\"selected\"";}?>
<option value="avatar1" <?php select($avatar, "avatar1");?>>avatar1</option>
<option value="avatar2" <?php select($avatar, "avatar2");?>>avatar2</option>
<option value="avatar3" <?php select($avatar, "avatar3");?>>avatar3</option>
[/code]
avatar1 is your value, and $type is your data so this is correct.
sorry to confuse you with the pm.php?pm=inbox I should have use it to fit your eg. at first... :-\
Ted
then you would also need to change the other value:
[code]
<select name='avatar'>
<?php function select($avatar, $type){if ($avatar == $type) echo "selected=\"selected\"";}?>
<option value="http://www.net-petz.com/images/avvies/Default_av1.jpg" <?php select($avatar, "http://www.net-petz.com/images/avvies/Default_av1.jpg");?>>avatar1</option>
<option value="http://www.net-petz.com/images/avvies/Default_av2.jpg" <?php select($avatar, "http://www.net-petz.com/images/avvies/Default_av2.jpg");?>>avatar2</option>
<option value="http://www.net-petz.com/images/avvies/Default_av3.jpg" <?php select($avatar, "http://www.net-petz.com/images/avvies/Default_av3.jpg");?>>avatar3</option>
[/code]

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.