I have a table with a button for each section of rows. When the user presses the button I would like to get an array with all rows where first column has the same ID as the button pressed.
What is the best solution for this?
table view:
Every row is in a “tr” and every value is in a “td”
When I use a form it only brings the row with the button.
I have tried to use session but having trouble to locate the row where the button is pushed.
I have tried to give every row a class name with the id. But having trouble getting the values.
All I made for now is HTML and PHP.
Pictures can illustrate a scenario, but we cannot fix pictures. As per How to Ask please provide a minimal reproducible example of the scenario so we can help you better. It sounds like you probably need some JavaScript, but it’s hard to be sure. “best” is a bit subjective, unless you have a much clearer and more precise specification and/or constraints.
Thanks for your answer. I have tried many different things. And deleted it again. I am pretty new is this world so my problem is what direction i should go. can i have a form that picks from multiple rows i a table? or is there a function where i can search a table for tr or td with a specific id or class. I can try to put in some code i have. But that is the code generating the table i have.
A form can cover an entire table, or a single cell in a table. Form tags aren’t allowed in between tr or td tags in HTML. Of course you could have multiple tables (each one containing a set of rows which share the same ID, and which is wrapped in a form tag), but just use HTML/CSS to make them look like one continuous table (if that’s even necessary for your UX).
that is the code generating the table i have
…it would likely be more useful to see the HTML which is the output of that code. You can get that from your browser’s Developer Tools when you load the page, of course.I had a form cover the entire table. But then i can’t figure out how to see what row a button is pressed.
Show 3 more comments