0
Good evening, I have here an urgent question, I have tried several solutions and I cannot understand
I intend to popular a combobox from a database, then 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>
Dude, you need to fix this html, the form has to finish just after all the controls. And usually the POST treatment is the first thing you do in the code.
– Júlio Neto
Man, I know what it’s like when the guy gets scared, but "urgent" is inelegant. It’s here and a community. There’s nobody working for others, you know? I say good, because I’ve been there and I’ve been reprimanded the same way.
– Vítor André
I’m sorry, if I offended you, I didn’t mean to. I do not want to get the job done, but I am a little exhausted, since yesterday I am trying to solve I have already researched a lot and my last solution was to use the forum.
– Rafael Cardoso