vendredi 24 juin 2016

how can i insert multiple marks for multiple students mysql


I have a dynamic table(that prints names of some students from a specific group in DB ) and for each student i have a checkbox where i have to choose the mark.I need help about how can i insert multiple marks for multiple students in mysql????

The table on the database where i have to do the insertof marks is sth like this: id name mark

and the code of html and php

<form>
<table >
<thead >
    <tr>
      <th>Nr</th>
      <th>Name_Surname</th>
      <th>Mark</th>
    </tr>
</thead>

 <tbody>
<?php
 $query = "select student.name from student where student.group = '2' " ;   
      $run=mysql_query($query);
      $d=1;
      while ($row=mysql_fetch_assoc($run))
{
?>
<tr>
<th ><?php echo $d++; ?>
</th>
<td>
<input type="text" name= "name" value = '<?php echo $row["name"];?> '>
 </td>
 <td>
 <fieldset >
 <label for="mark"></label>
    <select name="mark" >
    <option>-</option>
    <option>4</option>
    <option>5</option>
    <option>6</option>
    <option>7</option>
    <option>8</option>
    <option>9</option>
    <option>10</option>
    </select>
</fieldset>
</td> 
</tr>
<?php } ?> 
</tbody>
</table>
<button type="submit" name="save" >Printo</button>
</form>

Aucun commentaire:

Enregistrer un commentaire