problem with dropdown list

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
iijb
Forum Commoner
Posts: 43
Joined: Wed Nov 26, 2008 11:34 pm

problem with dropdown list

Post by iijb »

Hi all
In an Edit Profile Form I have to show all the options in a dropdown list with the current selected value from database as the default value. I got the value as current selected value but the problem is that the value is repeated twice in the option list. How to solve this.
Plz help

iijb
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: problem with dropdown list

Post by social_experiment »

You could select all the values that are not like the current one

Code: Select all

 <?php $query = "SELECT field FROM table WHERE field != current_value"; ?>
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
Post Reply