Forums

PHP

This topic is locked

checkbox select update database

Posted 07 Jun 2006 01:03:51
1
has voted
07 Jun 2006 01:03:51 na na posted:
Hello,
I have products each have a checkbox and an image button for get selected items

I want if the user select checkbox immediately update a database field even through multi pages so when the user click on the image button at any time I can filter and get all items that have this field = 1 for example

how to do that (without ajax plz)

thanks

(notice: I have a problem login in I have to enter my user name and password on the new toptic itself)

Replies

Replied 07 Jun 2006 11:47:46
07 Jun 2006 11:47:46 Roddy Dairion replied:
I don't want to misunderstand, lets c, tell me where i am wrong.
1.You have a table of Products
2.These are displayed on a PHP page
3.Next to each product you have a checkbox
4.You have an image button.

What you want to do is a multiple update/insert so the user select 2 or 3 checkboxes and click on the image button, and this is submitted. Right?
If am right then, you shud use an array, for the checkboxes which on submit will pass the selected product ID's, using a for loop count how many id's has been passed and execute the insert/update accordingly.
Replied 07 Jun 2006 13:35:15
07 Jun 2006 13:35:15 na na replied:
yes but there about 5 pages and the user may be select two items in the first page and two items in another page , how to get all selected items

what if there is a way to update a field in the database once the checkbox is selected , how to do that ?

if you can please give a sample code
Replied 07 Jun 2006 15:16:38
07 Jun 2006 15:16:38 Roddy Dairion replied:
Logically its wrong. Coz then user can click again and again in this checkbox which will coz it to submit over and over again. Just create a submit script that will submit the form on page 1, then goes to page2 then you create a submit script for this 1 as well etc......

Reply to this topic