I have a website where I want to provide an option for users, if they click on a table\'s rows, they get regirected to another page (based on the contect of the table row).
I basically want to get the id from the row and when the visitor clicks on the row, they should land on example.php?id=XXXXX
You can do so entirely from PHP. When you generate the table, in each row (whose id we'll call XXXX
to follow your example) you can include a link to example.php?id=XXXXX
, or an onclick
event for the whole row that executes window.location.href = 'example.php?id=XXXXX';
. So your table might look like:
...
1234 some value some other value
1235 some value some other value
...
It could be done a little nicer by generating the rows with javascript and using event listeners, but this should work.