Hi, Im putting together a page in php which populates a "<select multiple..." list box and displays data depending on what the user selects from the list box. I am posting the page back to itself using <?PHP echo $_SERVER['PHP_SELF']; ?>.
I have written the code that draws the form as a function. This function is called when the page loads and when the submit button is pressed.
This all works ok except that when the form is posted the selected list reverts back to its default values. I want the list to retain the users selections.
I've tried this but it doesn't work. It echos the word "SELECTED" every time whether the list entry is selected or not.
<form method=post action=<?$_SERVER['PHP_SELF']?>>
<input type=submit value="update display">
<select multiple name=display_list[]>
<option value='option_1' <?if($display_list="option_1") print ' SELECTED ';?>>option_1</option>
<option value='option_2' <?if($display_list="option_2") print ' SELECTED ';?>>option_2</option>
<option value='option_3' <?if($display_list="option_3") print ' SELECTED ';?>>option_3</option>
</select>
</form>
I think im doing something very simple wrong... or is that im doing something wrong very simply... or maybe im simple and im doing it wrong.... or maybe im simply wrong in doing it?
.................help ne1 (in noob language pls)?