Use href to open a php page from selected row
Use href to open a php page from selected row
I just love your tables, but have small problem. I need to open another php edit page filtered on the same record as the selected row. I use this in other "inferior "tables to yours, and it works just fine <td><a href="update2.php?u=<?php echo $row['id'] ?>"><span class="glyphicon glyphicon-pencil" aria-hidden="true" </span><b><font size="3" color="red"</font> Edit<b></a></td>
The table i am using now is the "Individual column searching (select inputs) and server-side"
Any advice please? Thx for assisting this novice and keep up good work pls
This question has an accepted answers - jump to answer
Answers
Use column.render to insert the url into your table.
See the manual and
columns.render
documentation for information on how to render a link into a DataTable from plain unformatted data.Allan
Perhaps i explained myself wrong. How do i pass a variable in a table, for example the "id" field from the selected row using the POST method, to another php form .(<a href="update2.php?u=<?php echo $row['id'] ?>"). Please be so kind to assist. I use a checkbox to select row.
To delete a row i use this now and it works. The same checkbox will be used to open the form update2.php using the same record. I need to push this "id" to the php page in URL from the table selected row
example for delete
In the table php i have
$nestedData[] = "<input type='checkbox' class='deleteRow' value='".$row['id']."' /> #".$i ;
The edit button id="editTriger and should open the update2.php page. I will then use this variable to filter the sql in update2.php
Thx for assisting pretty please
To be perfectly honest, I don't actually understand exactly what you are looking for.
You mention
editTriger
, but I don't see that anywhere in your code.The
columns.render
option is how you should create a button or a link inside a table's cell to open a new page.Allan
Thx. Got it working using this code, after 3 days of struggling, with only 3 lines of code. It's tough, when one is stupid. hehe The row[1] did the trick. Thx
Good to hear you have it working. Thanks for posting back.
Allan