Insertion in Mysql with radio button + <option> + input

Asked

Viewed 705 times

1

How to enter the value of the <input> as the radio button is selected? A model is annexed hereto:

inserir a descrição da imagem aqui

$funcionario = $this->funcionario->get_all_funcionario();
    if($funcionario->num_rows > 0){
    $row = $funcionario->row();
    $atributosfuncionario = array('name' => 'xd', 'class' => 'funcionario', 'value' => $row->pessoa_id);
    echo form_radio($atributosfuncionario);
    echo form_label('Funcionário');
    echo form_input(array('name' => 'pessoa', 'class' => 'selects', 'disabled' => 'disabled'), set_value('pesssoa', $row->nome));
    }
    $atributoscidadao = array('name' => 'xd', 'class' => 'cidadao');
    echo form_radio($atributoscidadao);
    echo form_label('Cidadão');
    echo '<select name="pessoa" class="select">';
    $opcao = $this->funcionario->get_all_pessoa()->result();
    foreach($opcao as $linha){
    echo '<option value="'.$linha->id.'">'.$linha->nome.'</option>';
    }
    echo '</select>';

When I register, he’s only taking the value of <option> Mário Silva, or any other value of <option>. Why can’t I get the value in the input text? I mark the radio button, and it still goes on! Does anyone know what it can be?

  • Dude, your question just got a little dodgy. You want to pull the value of <option> by submitting the form and then registering at the bank?

  • The data’s coming from the database, and it’s going to be fed into the comic book! I only put OBS: just to inform that the option data is being displayed dynamically, ie by the database!

1 answer

1

@user11545 regardless of the person checking or you taking from the bank will always be entered the value of the input, select, checkbox that is marked.

to get the value you send your form to a page like this.

$nome1 = $_POST["nomedoinput"];
$nome2 = $_POST["nomedoinput"];
$nome3 = $_POST["nomedoinput"];

and insert it into the seat like this

INSERT INTO tabela_nome VALUES ($nome1,$nome2,$nome3,...);

Browser other questions tagged

You are not signed in. Login or sign up in order to post.