I have created a table that displays the results from a MYSQL database. At the end of each row, I have added a button that when clicked on inserts the session username into the database. Apart from the session username I want to insert all t开发者_运维百科he other details present in the table ROW in which the button is present.
How do I do that?
I presume you have some sort of form for each row to hold your submit button?
If thats the case you can use hidden field form elements. in each cell of the row add an hidden field and set the values. upon when the user submits that info is passed to via POST or GET. Be warned that doing this means the user could tamper with the data before submitting entering invalid info.
To avoid the above issue you can just pass the ID of the row to the form and on submit read the id, get the result for the DB and then insert into into another table or database.
精彩评论