Hello, I am putting together a system for the college project. I have a relationship between City ---- State. Well, the state CRUD is already working and storing in the Database, when I go to register a city, that city needs a registered state, then, the fields of register the city stayed.
"City name" (input type text) and UF (Combobox already populated via a select) When I try to store in the bank the name of the city and the state coming from a combobox nothing appears in the bank, even without pointing out any errors. How do I perform the insert in db using a state in the combobox
<?php
include 'inc/funcoes.php';
$banco = abrirBanco();
?>
<html>
<head>
<title>Cadastro de Cidade</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<form name="Cidade" action="inc/funcoes.php" method="POST">
Nome da Cidade:
<input type="text" name="cidade" size="30" />
UF:
<select name="estados">
<option value="">Selecione</option>
<?php
$sql = "SELECT * FROM estado";
$resultado = $banco->query($sql);
while($row_estados = $resultado->fetch_array()){
?>
<option value="<?=$row_estados['idestado']?>"><?=$row_estados['nomeestado']?></option>
<?php
}
?>
</select><br><br>
<input type="hidden" name="acao" value="inserirCidade"/>
<input type="submit" value="Cadastrar Cidade">
<input type="reset" value="Limpar Dados">
</form>
</body>
</html>
Combobox Population Function Line: 17 - 26