Ok guys I know this might not be the correct way to ask a question but I have looked as far as I could go. I am a bit stuck on how to go about this problem, probably why I can't find a solution to it. I have a form that the info gets inserted to a db, then you are able to view the info from the database on another page that list everything inserted. My question is how would I go about selecting a row from the table that displays all the info from a row on the db and redirect to another page to edit it? I want to redirect to another page to view/edit all the info.
What I think would work is in the table that shows the info I could put a radio box and have a button at the top to click to edit that row. I don't really know how to assign that radio button to the actual row however.
Here is my table:
<?php
$sql = "SELECT * FROM employees ORDER BY LastName";
$result = $mysqli -> query($sql);
if ($result->num_rows > 0) {
echo "
<table class='table table-hover table-responsive'>
<thead class='thead-dark'>
<tr>
<th class='table-primary' scope='col'>#</th>
<th class='table-primary' scope='col'>First Name</th>
<th class='table-primary' scope='col-1'>M.I.</th>
<th class='table-primary' scope='col'>Last Name</th>
<th class='table-primary' scope='col'>Phone</th>
<th class='table-primary' scope='col'>Address</th>
<th class='table-primary' scope='col'>Email</th>
<th class='table-primary' scope='col'>Birth Date</th>
<th class='table-primary' scope='col'>EID</th>
<th class='table-primary' scope='col'>Gender</th>
<th class='table-primary' scope='col'>Ethnicity</th>
<th class='table-primary' scope='col'>Status</th>
<th class='table-primary' scope='col'>Hours</th>
<th class='table-primary' scope='col'>EAP Access</th>
</tr>
</thead>";
// output data of each row
while ($row = $result->fetch_assoc()) {
echo "
<tbody>
<tr class='table-dark'>
<td>" . $row['UserID']. "</td>
<td>" . $row['FirstName']. "</td>
<td>" . $row['Middle']. "</td>
<td>" . $row['LastName']. "</td>
<td>" . $row['PrimaryPhone']. "</td>
<td>" . $row['Address'] . $row['City'] . $row['State'] . $row['Zipcode']. "</td>
<td>" . $row['Email']. "</td>
<td>" . $row['DateOfBirth']. "</td>
<td>" . $row['EID']. "</td>
<td>" . $row['Gender']. "</td>
<td>" . $row['Ethnicity']." </td>
<td>" . $row['Status']. "</td>
<td>" . $row['Hours']. "</td>
<td>" . $row['eapAccess']. "</td>
</tr>
</tbody>";
}
echo "</table>";
} else {
echo "0 results";
}
?>
If I added a <input type="radio" name="selected">
before the userID
column like and had a button to select that row, how would I be able to have that row display on a seperate page?
I am still new to php, but this is beyond me and can't find anything remotely close to an answer.