AutumnDusk Posted November 20, 2007 Share Posted November 20, 2007 I'm a bit of a PHP noob, generally though I muddle through. But I have a drop-down list with set values. When there is a corresponding value in my database when the page loads I want the drop-down list to pick the appropriate value from the list. Instead it always defaults to the first value. Can anyone give me an example of how to do this? Also, one time after adding a variable to a classes file this symbol:  started showing up on all of my pages. Has anyone seen this before? I can't find any information on the web about it. Thanks for any help! Quote Link to comment Share on other sites More sharing options...
trq Posted November 20, 2007 Share Posted November 20, 2007 You might want to post some code. Quote Link to comment Share on other sites More sharing options...
AutumnDusk Posted November 20, 2007 Author Share Posted November 20, 2007 Sorry about that: <tr><td valign="bottom">City Area</td><td> <select name="region" size="1" class="inputbox"> <option value="Edmonton - North" <?php if ($row->$region = "Edmonton - North") { ?> selected="selected"<?php } ?>>Edmonton - North</option> <option value="Edmonton - East" <?php if ($row->$region = "Edmonton - East") { ?> selected="selected"<?php } ?>>Edmonton - East</option> <option value="Edmonton - South" <?php if ($row->$region = "Edmonton - South") { ?> selected="selected"<?php } ?>>Edmonton - South</option> <option value="Edmonton - West" <?php if ($row->$region = "Edmonton - West") { ?> selected="selected"<?php } ?>>Edmonton - West</option> <option value="Edmonton - Region" <?php if ($row->$region = "Edmonton - Region") { ?> selected="selected"<?php } ?>>Edmonton - Region</option> <option value="Calgary" <?php if ($row->$region = "Calgary") { ?> selected="selected"<?php } ?>>Calgary</option> <option value="Northern Alberta" <?php if ($row->$region = "Northen Alberta") { ?> selected="selected"<?php } ?>>Northern Alberta</option> </select> </td></tr> Quote Link to comment Share on other sites More sharing options...
rarebit Posted November 20, 2007 Share Posted November 20, 2007 Add 'selected' to one of the elements: <option selected> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.