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>
Link to comment
Share on other sites

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?
Link to comment
Share on other sites

[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
Link to comment
Share on other sites

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]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.