Save Form "Presence Record" - Multiple Radios Inputs

0

Hello, guys, how are you?

I am developing a system to register the presence of the academics of an educational institution, the form data (Course, subjects and students) I am searching for web service of the teaching system of them, see the image below of how it was:

Tosavethefirstthreeinputsisquiet,myproblemisthatIcouldnotthinkofhowtosavethislistofINPUTSRADIOwithinthetable,becausetheNAMESoftheinputsIfilleddynamicallywiththeID'softhestudents,followtheexamplebelow:

STUDENT1:

<input type="radio" name="5334" value="1" /> <!--(Esse representa o "Presente")-->
<input type="radio" name="5334" value="0" /> <!--(Esse representa o "Ausente")-->

STUDENT 2:

<input type="radio" name="5452" value="1" /> <!--(Esse representa o "Presente")-->
<input type="radio" name="5452" value="0" /> <!--(Esse representa o "Ausente")-->

Please if anyone can give me a light I am very grateful.

OBS: I use PHP 7, apache 2.4 and Laravel 5.4 as a framework.

    
asked by anonymous 03.03.2017 / 19:57

1 answer

-1

You need to pass the data in array format, I'm not sure how to explain it but you can create an input with the same name and save the data in php afterwards through a foreach

No html:

<input type="radio" name="ausente[][id_do_aluno]" value="1" />
<input type="radio" name="presente[][id_do_aluno]" value="0" /> 

In PHP:

$valores = $_POST['ausente'];

foreach($valores as $valor){
   //aqui você terá uma array com os valores, use-os como desejado
   var_dump($valor);
}
    
06.03.2017 / 19:50