Hi all!
I have a drop down list that should display the selected value from the stored session variable when the user returns to the page to review his/her response.
I know that I'm meant to echo the selected value, but i'm not quite sure how to go about doing that.
With my current code, it's adding the word SELECTED at the end of the selected option instead of showing it as the selected option.
Here is my code:
<select name="division" id="division" >
<option value="0">---Please Select---</option>
<option value="1">Executive Office Division
<?php if($_SESSION['answer']['division'] == "1") echo "SELECTED"; ?>
</option>
<option value="2">Sales & Marketing Division
<?php if($_SESSION['answer']['division'] == "2") echo "SELECTED"; ?>
</option>
<option value="3">Sales & Operations Division
<?php if($_SESSION['answer']['division'] == "3") echo "SELECTED"; ?>
</option>
<option value="4">Admin & Finance Division
<?php if($_SESSION['answer']['division'] == "4") echo "SELECTED"; ?>
</option>
</select>
Would be great if anyone can help me out with this.
Thanks!