Save multiple input in table

Hi everyone. thanks u for u help
i’m working on a school project. I’m trying to save some data so let me explain table
so for each exercice i have a mark.
there is a table for exercice to get the exercice name, and i want to save the mark of each exercice, in a table called mark_exercice which contain the id the the exercice and the mark of course. her is the code i did until now :









Preformatted text
    <?php foreach ($missionsPns['exercicespn'] as $key => $missionsPn): ?>
  <tr>
    <td class="tg-0lax"><?php echo h($missionsPn['NOM']); ?></td>
<td class="tg-0lax"><div ><input name="data[noteexercice][note]"  value="M" type="checkbox"  id="NoteM"></div></td>
<td class="tg-0lax"><input name="data[noteexercice][note]"  value="E" type="checkbox"  id="NoteE"></td>
<td class="tg-0lax"><input name="data[noteexercice][note]"  value="C" type="checkbox"  id="NoteC"></td>
<td class="tg-0lax"><input name="data[noteexercice][note]"  value="B" type="checkbox"  id="NoteB"></td>
<td class="tg-0lax"><input name="data[noteexercice][note]"  value="A" type="checkbox"  id="NoteA"></td>
       
  </tr>
    <?php endforeach; ?>
</table>

when i do the debug for the request data i got this : array(

	'noteexercice' => array(
		'note' => 'A'
	)
)

so i wish i could save the mark with the id of the name of the exercice.

Exercice M E C B A

You need to add hidden inputs with the IDs that you want to include.

thanks you, but how to do it can u give me an example

Nope. We don’t do school projects for people. We help to resolve specific problems. That means you need to put in some effort first, and when you hit a wall you show what you’ve done and explain how it’s not producing the desired result. You said you need to save with the ID of the exercise, I told you hidden inputs are the way to go. It’s up to you now to go and learn about hidden inputs, write some code, and if that doesn’t work, you show what you have and we help with that.

okey thank u for your help i understand,
i did this
<?php foreach ($missionsPns['exercicespn'] as $key => $missionsPn): ?>


<?php echo h($missionsPn['NOM']); ?>
            <td class="tg-0lax"><input  name="<?php echo  h($missionsPn['ID']);?>" value="M" type="checkbox"  id="NoteM"></td>
            <td class="tg-0lax"><input  name="<?php echo  h($missionsPn['ID']);?>"  value="E" type="checkbox"  id="NoteE"></td>
            <td class="tg-0lax"><input name="<?php echo  h($missionsPn['ID']);?>"  value="C" type="checkbox"  id="NoteC"></td>
            <td class="tg-0lax"><input name="<?php echo  h($missionsPn['ID']);?>"  value="B" type="checkbox"  id="NoteB"></td>
            <td class="tg-0lax"><input name="<?php echo  h($missionsPn['ID']);?>"  value="A" type="checkbox"  id="NoteA"></td>
               
          </tr>
            <?php endforeach; ?>

so when i do the debug for the request data i got for eash id of exercice a valu which is the mark, now how to split this request data so i can get the id of the exercice and the mark to get
saved

aa

i know how to add a hidden input with the ID of the exercice i want, but how to link between the mark and its exercice ID?

You’d want to use names like Marks[0][mark] for the checkboxes, and Marks[0][exercise_id] for the IDs. Increase 0 to 1 to 2, etc. for each exercise. Read about Cake’s field naming conventions for details.