how to retrived records in grid from mysql db to php form
i want to fetch data from mysql database table in grid in php with checkboxes.
when user select checkbox only selected data should be copied to other table and unselected data should be deleted from table.
ex. I have 2 tables request and users
and in my form i have 2 button approve and disapprove
in form all records from request table will be shown in grid with checkbox
when user select some checkboxes only selected data will be transfer to users table and unselected daata will be deleted from request table.
i am learning php .. guys please help
As Codex says - your question presents some rather advanced programming techniques. From what I gather you want to display two tables on the screen and using a checkbox, move a set of data from what table to the other table. Correct?
To do that in real-time without a refresh of the page you do need to do some new technologies. OTOH - if you can live with the refresh and a call to the server to achieve your end result, simply make each row of your table #1 a form by itself and use a button rather than a checkbox. A click on a button will trigger a call to your server script where you can take the data from that form and put it into the set of data in your table #2, removing it from the table #1 data. Then your script simply re-builds the page and sends it back. Of course this means using a session var to keep track of the data in table #2 and another to eliminate those records from table #1.
I am imagining that you would have a set of record keys that comprise the total set of data. To start all the records belong to one html table. As you go thru the selection process to move things you would have to split that set of keys into the #1 keys and the #2 keys. I would use two session vars to hold these during the process. Then you could use those two sets (arrays?) of keys to query your db twice - once to re-build the table #1 output and once for the #2 output.
I am also changing your design from having the ability to do multiple selections at a time. If you want to do that, then you would have to use checkboxes all in one form where each box held the value of that record's key. Then you could still build the two session vars I mentioned, adding the key to the #2 var and removing it from the #1 var. Then do the re-build.
Sounds complicated but at this point in your development this will be a bit easier.
PS - If you're posting here you should be using:
error_reporting(E_ALL | E_NOTICE);
at the top of ALL php code while you develop it!
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread