Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem using drop down menus to edit data (PHP/MySQL)

Status
Not open for further replies.
Jun 24, 2002
2
US
I’m having a problem-using drop down menus on a form to edit existing data in a MySQL database… Any help on this would be appreciated. My desk is beginning to get a groove in it from where I’ve been banging my head on it.

Here’s a short version of where I’m at now…

When we hire a new employee for the company we set in motion a form so that we can better track and acquire any technologies they may require to do the job. We “pass” this form on to each other, as one person needs to fill in one section of the form, another person fills in the next, etc…On the form I have the equipment we supply (cell phone, beeper, laptop, etc…) and a “Yes/No” drop down menu after each item so that we know what they need. And this is where my problem begins.

I.e. – Person “A” has completed their part of the form and when person “B” goes to make their entries, they notice a mistake in person “A’s” section… If person “B” tries to change the value, it will allow them to change it in the drop down menu but when they hit the “Submit” it never takes the new value and applies the change in the database.

Here is a snippet of the code I’ve been attempting to get to work… The end result was supposed to be that it would pull the existing data from the database and display it, while giving the options of the original drop down menu. (Laugh where you feel necessary)

<SELECT name=&quot;beeper&quot;>
<OPTION value=&quot;<?php echo $beeper ?>&quot; selected><?php echo $beeper ?>
<OPTION value=&quot;Yes&quot;>Yes
<OPTION value=&quot;No&quot;>No

This successfully pulls back the existing data in the database, stating whether or not the person should have a beeper, and displays it. It also gives them the YES/NO options I want them to have but this does not update the database with the option they have selected if they change it from the existing value.

Anyone have any ideas as to what I need to do to get around this?

Thanks,
SWBradbury
 
Try: <OPTION value=&quot;<?php echo $beeper; ?>&quot; selected><?php echo $beeper; ?> divine_dragon9999@yahoo.com
 
I don't really think your question can be answered as asked.

The problem is not in the HTML, but rather in the PHP that drives the app. We do not know anything about your logic, your database schema, or even your database vendor to know how to advise.

The only thing I can comment on is the HTML you've output. I would not just add the option that represents the current setting to the list. I would have whichever value it is, either &quot;yes&quot; or &quot;no&quot; be selected, instead. It makes for a cleaner user interface.

______________________________________________________________________
Did you know?
The quality of our answers is directly proportional to the number of stars you vote?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top