I have an HTML table with text and radio inputs that i want to insert each row into my MySQL table with PHP
MySQL table looks like this:
================================
| Name | Status | Ext |
================================
HTML table
===============================================================
| Name | Present | Excused | Unexcused | Ext |
===============================================================
| text input1 | o | o | o | textarea |
---------------------------------------------------------------
| text input2 | o | o | o | textarea |
and so on...
*o's are radios
it gets values from a MySQL query loop and i want it to be only one of the radios can be clicked and it sends the clicked one into the Status column
Code
<form method="post" action="insert.php" enctype="multipart/form-data">
<table>
<tr>
<th>Name</th>
<th>Present</th>
<th>Excused</th>
<th>Unexcused</th>
<th>Ext</th>
</tr>
<?php
echo "<tr>";
$query = "select * from TbCard";
$sql = mysqli_query($connect, $query);
while ($data = mysqli_fetch_array($sql)) {
echo '<tr>';
echo"<td><input id='name' type='text' value='" . $data['Name'] . "' readonly style='border:none;width:350px'></input></td>";
echo"<td><input type='radio'></td>";
echo"<td><input type='radio'></td>";
echo"<td><input type='radio'></td>";
echo"<td><textarea></textarea></td>";
echo '</tr>';
}
}
echo "</tr>";
?>
</table>
<input type="submit" value="Insert">
</form>
EDIT: The table is in a form tag and has the action to another .php and i want a submit button to insert it