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
https://forums.phpfreaks.com/topic/209822-scroll-menu-and-sql/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.