Jump to content

Recommended Posts

hi,

my code goes something like this..

<form action=samepage.php>
<select>
<option name="nick">nick
<option name="harry">harry
</select>
<input type=text name=msgbox>
.
.
.
<input type=submit name=submit>
</form>

its actly meant for selecting a user from the combo box and sending the message typed in the text field.
however, after i click send, the value of combo box resets to the first value...and i again have to select it from the box.

Isnt there any way that i can make the box static so that the next time i dont have to select the recepient of my msg..

Thanks.
Link to comment
https://forums.phpfreaks.com/topic/6010-static-combo-box/
Share on other sites

That depends on how you use the form and what you want to do with it. If you just want to come back to the page and have the user selected again, you can set it from the $_POST/$_GET array, or you could set a cookie and pull it from that.

Once you have the value in a cookie or in the POST/GET super global array, all you have to do is create an option like this:

<option value="harry" selected="selected">harry</option>

Then just create your other options normally.
Link to comment
https://forums.phpfreaks.com/topic/6010-static-combo-box/#findComment-21578
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.