0
Well, I am trying to change only a specific cell in Mysql using a PHP form, however, I cannot perform such action and no error is shown so I try to fix it, how can I fix the problem?
Logic
<?php
require("conecta.php");
$novoTituloDisciplina = $_POST["novo-titulo-disciplina"];
$valorDisciplina = $_POST["disciplina-a-alterar"];
$query = "update table disciplinas set 'nome_disciplina' = '{$novoTituloDisciplina}' where id = '{$valorDisciplina}'";
if(mysqli_query($conexao, $query)){
mysqli_close();
header("Location:../cadastra_novo.php");
}else{
mysqli_close();
header("Location:../index.php");
};
Form
<form action="logicas/logica-altera_disciplina.php" method="post">
<div>
<h3>Alterar Disciplina</h3>
</div>
<label>Disciplina</label>
<select name="disciplina-a-alterar">
<option disabled selected>-Selecione a disciplina-</option>
<!-- Receber as opções disponíveis no banco de dados -->
<?php
$disciplinas = listagemDisciplinas($conexao);
foreach ($disciplinas as $disciplina){
?>
<option value="<?= $disciplina["id"] ?>"><?= $disciplina["nome_disciplina"] ?></option>
<?php
}
?>
</select>
<label>Novo nome</label>
<input type="text" name="novo-titulo-disciplina">
<button type="submit">Alterar</button>
</form>
that’s what I just did here, I came to delete the question, but since you gave the correct answer, I’ll return to answer
– Murilo Melo