I print some information from my database using php.I show it in a table format by using html.At each row there are 3 buttons where user can make changes about that course in that specific row.The problem is I can not define all of the buttons in that table.If it was a single submit button I would give it a name and then get the data by $_POST['name'] but with multiple rows I am confused. Here is my code:
for($i=0;$i<$myarray_lenght;$i++)
{
$row_id=$i;
echo "<tr>";
echo "<td><form action='private_page.php' method='POST'> <input type='radio' name=$row_id value='edit'> </form> </input></td>";
echo "<td>". $myarr[$i]['thesis_name']. "</td>".
"<td>" .$myarr[$i]['student_id']."</td>"
echo "<td><form action='private_page.php' method='POST'> <input type='submit' name='more_info' value='Get more info of the Student !'> </form></input></td>";
echo "<td><form action='private_page.php' method='POST'> <input type='submit' name='remove' value='Remove the Student !'> </form></input></td>";
echo "</tr>";
}
I have tried to identify each row by an edit button and then said that whenever that that row (the radio button) is clicked, get the information from that row like that:
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
//something posted
for($i=0;$i<100;$i++)
if (isset($_POST[$i])) {
if (isset($_POST['more info'])) {
// do something.
}