Jump to content

Scroll menu and SQL


Steve99

Recommended Posts

Hi everybody. I'm pretty new in PHP programmation and really new on this forum. So, I'll try to explain my situation the best I can.

 

I have created a modification page where the user can modify certain data of the database. To avoid spelling mistakes, I have created a scroll down menu that includes all the options they have.

 

My problem is that I what the "actual Selection" of the database to be the "selected" option right from the start. Now, my scroll0-down menu shows the first option of my list and not the actual value contained in the database.

 

Here is my partial code:

 

<td><select name="equipe" value="<?php echo($result->equipe) ;?>">
					<option <?php if (($result->equipe) == 'Colorado') echo "selected" ?>value='Colorado'>Colorado</option>
					<option <?php if (($result->equipe) == 'St-Louis') echo "selected" ?>value='St-Louis'>St-Louis</option>
					<option <?php if (($result->equipe) == 'Montreal') echo "selected" ?>value='Montreal'>Colorado</option>
					<option <?php if (($result->equipe) == 'Washington') echo "selected" ?>value='Washington'>Washington</option>
					<option <?php if (($result->equipe) == 'Islanders') echo "selected" ?>value='Islanders'>Islanders</option>
					<option <?php if (($result->equipe) == 'Edmonton') echo "selected" ?>value='Edmonton'>Edmonton</option>
					<option <?php if (($result->equipe) == 'Floride') echo "selected" ?>value='Floride'>Floride</option>
					<option <?php if (($result->equipe) == 'Pittsburgh') echo "selected" ?>value='Pittsburgh'>Pittsburgh</option>
					<option <?php if (($result->equipe) == 'Anaheim') echo "selected" ?>value='Anaheim'>Anaheim</option>
					</select>

 

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.