Hello all. I am having an issue displaying data in a form that IF EXISTS (not blank) will cause that option to be selected. The looping itself works. The variable called into the form works. Just can't seem to get the form to SELECT the correct variable.
<select name="size" id="size">
<?php while ($lrow = mssqlfetchassoc($tres))
<option value="<?php echo $lrow['ts_id'];?>">
<?php if($lrow['tsdescription'] == $info['size']) echo 'selected';?>
<?php echo "$lrow[tsdescription]";?> </option>
So this is displaying the team captain's TShirt size from a database (mssql). In the database the field is called tsdescription. For sake of argument, let's say the tshirt description is "Blue 2XLarge". This variable exists and is passed into the form for updating by the team captain, if necessary.
The loop works, as it loops through all the tshirt options (107 in total) and works as a pull-down menu. Somehow my IF statement doesn't work. What I am looking for is for PHP to "find" the existing tshirt description 'tsdescription' in the loop statement, and if found, cause it to be "Selected".
The $info are the variables for the form when the captain's information page is loaded. So far, by itself, the $info['size'] returns the correct tshirt. "by itself" the dropdown works. Thus, something must be amiss in my IF statement.
Can anyone help direct me to what I am missing to make this work? Thanks in advance.