Hi, I have a select box for the usr to select which criteria they wish to search by. Once a user has selected an option and pushed serach, I would like to set the option as a session varaible so that when the page reloads, it will have the option they chose as the default value.
I've written the code for the select box but I just don't know how to set the default value as the option the user just choose.
I know all I need to do to set a default value is to add 'SELECTED' to it, but I want this value to be set depending on what the user selects.
Could someone give me an idea of how to get this started?
I know I need a session var, and I need to set it everytime the serach button is pushed. But I dont know how I encorporate it into the select box code.
Please help..
Cheers, Tony
I've written the code for the select box but I just don't know how to set the default value as the option the user just choose.
Code:
echo '<select name="searchby">';
echo '<option value="first">First Name</option>';
echo '<option value="last">Last Name</option>';
echo '<option value="extnum">Ext Num</option>';
echo '<option value="outlet">Outlet Ref</option>';
echo '</select><br><br>';
I know all I need to do to set a default value is to add 'SELECTED' to it, but I want this value to be set depending on what the user selects.
Could someone give me an idea of how to get this started?
I know I need a session var, and I need to set it everytime the serach button is pushed. But I dont know how I encorporate it into the select box code.
Please help..
Cheers, Tony