Write data to the bank [closed]

2

Hello, I have a function in javascript that adds fields to my form. And I want to save the values of these fields in my database. The field code is these.

            <div><input type="radio" name="opcao2" value="Mae"/><label>Mae</label>
            <input type="radio" name="opcao2" value="Pai"/><label>Pai</label>
            <input type="radio" name="opcao2" value="Madrasta"/><label>Madrastra</label>
            <input type="radio" name="opcao2" value="Padrastro"/><label>Padrastro</label>
            <input type="radio" name="opcao2" value="Avó"/><label>Avó</label>
            <input type="radio" name="opcao2" value="Avô"/><label>Avô</label>
            <input type="radio" name="opcao2" value=""/><label>Outro</label>
            <input type="text" name="opcao2" />
            </br>
            <label>Nome:</label>
            <input type='text' name='nome_resp'/>
            <label>RG:</label>
            <input type="text" name="rg_resp"/> 
            <label>CPF:</label>
            <input type="text" name="cpf_resp"/> 
            <label>Telefone:</label>
            <input type="text" name="telefone_resp"/>
            <label>Celular:</label>
            <input type="text" name="celular_resp"/>
            <label>E-mail</label>
            <input type="text" name="email_resp"/></div>

My PHP looks like this:

$respon = new Responsavel($db);

$respon->id_aluno = $_POST['rg'];//gravar com RG
$respon->parente1 = $_POST['opcao2'];
$respon->nome1 = $_POST['nome_resp'];
$respon->rg1 = $_POST['rg_resp'];
$respon->cpf1 = $_POST['cpf_resp'];
$respon->telefone1 = $_POST['telefone_resp'];
$respon->celular1 = $_POST['celular_resp'];
$respon->email1 = $_POST['email_resp']; 
if($respon->criar()){
    echo "<script>alert ('Gravado com sucesso')</script>";
}
    
asked by anonymous 14.01.2016 / 13:46

0 answers