Jump to content

static combo box


nikhilthecool

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

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.