473,387 Members | 1,420 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

update database with dropdown menu

Hi,

I have a small code is listing mysql records in php+html screen. ex:

id, name, email, phone, status
1 test test@test.com 12345 1 -----> dropdown
2 test1 test1@test1.com 22222 3 -----> dropdown

I just want to change one record with a dropdown box at the same screen. ex: status option "1,2,3..."

for example let's say 1st record status is "1" and I want to change the value to "3" while I was querying all the records.

I hope explanation is clear,

Is there some sample script for my question

Thanks
Feb 12 '10 #1
1 1959
dlite922
1,584 Expert 1GB
There's a few ways to do this. The best one depends on your setup.

Here's one:

1. Put the unique id of these records in line with the rest of the record, and the dropdown, in a hidden html form.

2. Loop through your records and issue an update statement for each of records.

Although this would mean, records who's status didn't change, would also get an update statement. This is not real big issue for a few records but if you have tens or hundreds it might be a good idea to update only the ones that did change status.

For this, again you can use a hidden form field to store the previous status value. In your loop you would compare the current value with the previous value, if different, you then issue an update statement.

Alternatively you could just have a boolean flag hidden field that changes from 0 to 1 when the record is changed.

Why is the status 1? does it really have a business meeting or is it an application design carried over to the business.

What I mean is , does the 1, 2, 3 represent a meaning or word in English? For example 1 = Not Called, 2 = Called and Interested, 3 = Called and Not Interested.

If so, then you should display that for the user between the <option></option> tags and just put the numbers in the <option value=""> parameter.

<option value="1">Customer Called</option>
<option value="2">Customer Interested</option> etc...

Good luck,






Dan
Feb 12 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: LG | last post by:
I have asked before but I did not get all the answer I wanted. Perhaps I explained too bad. I have my site in frames, and the dropdown list is in the 'left' frame, and I have used javascript so...
4
by: Tim | last post by:
Hi, I've been searching the web for hours now and found lots and lots of javascript files with which you can create dropdown menu's, but with all of them you have to specify the width of the...
3
by: ACaunter | last post by:
Hi there, can someone please tell me what the easiest way to have a dropdown menu bar positioned on the screen (eg. Home, company, ... , contact us) then when the mouse goes over then, the sub...
2
by: Ian Davies | last post by:
Hello Ive been informed that I need to do the following in javascript. I have two drop down menus in my php script. The items displayed in the second is dependent on which item is choosen from the...
4
torquehero
by: torquehero | last post by:
Hi all :) I have created a horizontal navbar using Xara Menumaker. The Menu items have several dropdown menus. Its a javascript. When the mouse cursor is moved over any menu item, a dropdown...
3
by: Ninio | last post by:
I have a simple form with a dropdown menu that consists of 3 option and each option should retrieve a query from a database. i have been looking all over the place and can't seem to find how to do...
0
by: temp304 | last post by:
Customize Dropdown Menu is designed to display some choices, as: languages, countries, themes,... but it's differrent from original version in browsers. This tool combine CSS and JavaScript to create...
19
by: Jim | last post by:
Hi, I have two questions/problems pertaining to CSS horizontal dropdown menus and am hoping that someone here can help me out. (1) I'm having a problem centering the menu. I picked up the...
0
by: Helena Tran | last post by:
I'm doing a dropdown-menu, and combine JS. It's display well in all browser, but it has an error when displaying in IE 7,8 browser: Menu dropdown in normal : ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.