I'm working on a profile page, where a registered user can update their information. Because the user has already submitted their information, I would like their information from the database to populate my HTML form.
Within PHP, I'm creating the HTML form with the values filled in. However, I've tried creating an IF statement to determine whether an option is selected as the default value. Right now, my website is giving me a default value of the last option, Undeclared. Therefore, I'm not sure if all IF statements are evaluation as true, or if it is simply skipping to selected=selected.
Here is my HTML, which is currently embedded with PHP():
<select name="Major">
<option if($row[Major] == Accounting){ selected="selected"}>Accounting</option>
<option if($row[Major] == Business Honors Program){ selected="selected"}>Business Honors Program</option>
<option if($row[Major] == Engineering Route to Business){ selected="selected"}>Engineering Route to Business</option>
<option if($row[Major] == Finance){ selected="selected"}>Finance</option>
<option if($row[Major] == International Business){ selected="selected"}>International Business</option>
<option if($row[Major] == Management){ selected="selected"}>Management</option>
<option if($row[Major] == Management Information Systems){ selected="selected"}>Management Information Systems</option>
<option if($row[Major] == Marketing){ selected="selected"}>Marketing</option>
<option if($row[Major] == MPA){ selected="selected"}>MPA</option>
<option if($row[Major] == Supply Chain Management){ selected="selected"}>Supply Chain Management</option>
<option if($row[Major] == Undeclared){ selected="selected"}>Undeclared</option>
</select>