Jump to content

Saving/Loading Data in Drop-down list


AutumnDusk

Recommended Posts

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!

Link to comment
Share on other sites

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>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.