0
I have the following code:
<label>Cidade</label>
<select class="form-control select2 select2-hidden-accessible" style="width:100%;" tabindex="-1" aria-hidden="true">
<option selected="selected" value = "0">Selecione</option>
<?php
$result_situacao = "SELECT * FROM `tabela_cidades`";
$con = $conn->query($result_cidade) or die($conn->error);
while($dado = $con->fetch_array()){ ?>
<option value="<?php echo $dado['id_cidades']; ?>" name = "cidade"><?php echo $dado['nome_cidades']; ?></option>
<?php } ?>
But when will I capture the dice using that statement:
$id = mysqli_real_escape_string($Conn, $_POST['city']);
Error appears:
Notice: Undefined index: cargo in C: wamp64 www sistema paginas processos cad_clientes.php on line 5
I believe I am doing wrong to get the selected value in the plugin jQuery SELECT2, but I don’t know what’s wrong.
Ever tried to give a
print_r( $_POST);
to verify which variables were passed via POST?– adrianosymphony
Who is $result_city ? And what is $result_situation for ?
– user60252
Change the attribute "name" put it in select and not in options. Also make sure your variables $result_city and $result_situation are correct
– Leo Letto