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 I will capture the data using this statement:
$ id = mysqli_real_escape_string ($ conn, $ _POST ['city']);
The error appears:
Notice : Undefined index: title in C: \ wamp64 \ www \ system \ pages \ processes \ cad_clients.php on line 5
I think I'm doing it wrong to get the value selected in the jQuery SELECT2 plugin, but I do not know what's wrong.