nikhilthecool Posted March 28, 2006 Share Posted March 28, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/6010-static-combo-box/ Share on other sites More sharing options...
ober Posted March 28, 2006 Share Posted March 28, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/6010-static-combo-box/#findComment-21578 Share on other sites More sharing options...
nikhilthecool Posted March 28, 2006 Author Share Posted March 28, 2006 Hey ober,The $_POST['....'] trick worked.Great man...Thanks a lot. Quote Link to comment https://forums.phpfreaks.com/topic/6010-static-combo-box/#findComment-21594 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.