Good night, I have an urgent question here, I have tried several solutions and I can not understand
I intend to populate a combobox from a database, then I want to select a value and delete it.
<html>
<form action="presidente_apaga_utilizadores.php" method="post">
Selecione o ID a apagar:
<select name="nome">
<option value="option"></option>
</form>
<?php
require("basedados.h");
$sql="SELECT nome FROM utilizador where tipo_utilizador !=1";
$result = mysqli_query($conexao, $sql);
while($row = mysqli_fetch_array($result)){
$nome = $row["nome"];;
echo '<option value="' . $nome .'">' . $nome . '</option>';
}
if ($_POST(["nome"])) {
$sql = "DELETE FROM utilizador WHERE nome = '$nome'";
$resultado = mysql_query($sql);
echo " Registo Apagado!<p>";
}
?>
</select>
<input type="submit" value="Submit"><br>