Send multiple radio in a form to the database

0

I need to create an input type="radio", where there will be several searches and will store the responses in the database according to the selected option.

How could I do to enter all the search responses in the same table?

Below is HTML code with radios.

						<tr>
							<td>
							    
			<div class="radio">
		<input type="hidden" id="questao" name="questao" value="84">
	<label><input type="radio" value="291" name="84">Ótimo</label>
<label><input type="radio" value="292" name="84">Bom</label>
<label><input type="radio" value="293" name="84">Regular</label>
<label><input type="radio" value="294" name="84">Fraco</label>
			</div>
						
							
							</td>
					    </tr>
					    <tr>
							<td>
								
					<div class="radio">
	<input type="hidden" id="85" name="85" value="85">
	<label><input type="radio" value="295" name="85">Ótima</label>
	<label><input type="radio" value="296" name="85">Boa</label>
    <label><input type="radio" value="297" name="85">Regular</label>
	<label><input type="radio" value="298" name="85">Fraca</label>
						</div>
								
							
							</td>
						</tr>
						 <tr>
							<td>
							
								
				<div class="radio">
	<input type="hidden" id="86" name="86" value="86">
	<label><input type="radio" value="299" name="86">Ótimo</label>
	<label><input type="radio" value="300" name="86">Bom</label>
       <label><input type="radio" value="301" name="86">Regular</label>
	   <label><input type="radio" value="302" name="86">Fraco</label>
					</div>
								
							
							</td>
						</tr>
						 <tr>
							<td>
							
								
					<div class="radio">
		<input type="hidden" id="87" name="87" value="87">
		<label><input type="radio" value="303" name="87">Ótimo</label>
		<label><input type="radio" value="304" name="87">Bom</label>
		<label><input type="radio" value="305" name="87">Regular</label>
	    <label><input type="radio" value="306" name="87">Fraco</label>
									</div>
								

							</td>
						</tr>

Below is a function made in laravel within a controller

public function enviando(Request $request)
            {
                $date = date("Y-m-d h:m:s");
                $pegar_ip = $_SERVER["REMOTE_ADDR"];

                if($_POST = '84'){
                    $questao_id = '84';
    }
    if($_POST = '85'){
        $questao_id = '85';
    }
    if($_POST = '86'){
        $questao_id = '86';
    }
    if($_POST = '87'){
        $questao_id = '87';
    }

                DB::table('eventos_avaliacoes_participantes')
                        ->insert(['avaliacao_id' => "2",
                                 'nome' => $request->input('nome'),
                                 'email' => $request->input('email'),
                                 'sexo' => $request->input('sexo'),
                                 'comentarios' => $request->input('comentarioevento'),
                                 'ip' => $pegar_ip,
                                 'created' => $date]);


                $id = '171';
                $opcao = $request->input('84');
                DB::table('eventos_avaliacoes_participantes_opcoes')
                        ->insert(['opcao_id' => $opcao,
                                 'questao_id' => $questao_id,
                                 'participante_id' => $id+1]);






            return redirect('sucesso');

            }
    
asked by anonymous 24.10.2018 / 20:08

0 answers