Question : Choosing select value in a dynamic dropdown

I have a dynamic drop down menu and i need to  set the 'selected' value.

Here's the code:

<select name="related1" id="related1"><option value="please select" selected="selected">please select</option>
              <?php
do {  
?>
              <option value="<?php echo $row_Recordset2['id']?>;<?php echo $row_Recordset2['image']?>;<?php echo $row_Recordset2['code']?>"<?php if (!(strcmp($row_Recordset2['name'], $row_Recordset2['name']))) {echo "selected=\"selected\"";} ?>><?php echo $row_Recordset2['name']?></option>
              <?php
} while ($row_Recordset2 = mysql_fetch_assoc($Recordset2));
  $rows = mysql_num_rows($Recordset2);
  if($rows > 0) {
      mysql_data_seek($Recordset2, 0);
        $row_Recordset2 = mysql_fetch_assoc($Recordset2);
  }
?>
            </select>


For some reason although "please select" is selected it shows as the last value?????

Any help would be great!
Attachments:

Answer : Choosing select value in a dynamic dropdown

>>This causes each field to be blank filled. <<
Actually that is not what it states.  Here it is again:

The SET ANSI_PADDING setting does not affect the nchar, nvarchar, ntext, text, image, and large value. They always display the SET ANSI_PADDING ON behavior. This means trailing spaces and zeros are not trimmed.

So if there are trailing spaces it is coming from your code.

But don't take my word for it, test the following out in SSMS:
1:
2:
3:
4:
5:
INSERT tblContactInformation(FirstName) VALUES ('SheahaST')

SELECT	'|' + FirstName + '|'
FROM	tblContactInformation
WHERE	FirstName = 'SheahaST'
Random Solutions  
 
programming4us programming4us