I have a problem with the update with php and mysql, it does not work, and it does not update the values of the bd table.
The code is as follows:
html:
<form action="actualizar.php" method="POST">
<h2><em>Actualizacion de Institucion</em></h2>
<label for="cod_institucion">Codigo Institucion: </label>
<input type="text" name="cod_institucion" class="form-input" required/>
<label for="nombre_institucion">Nombre Institucion: </label>
<input type="text" name="nombre_institucion" class="form-input" required/>
<label for="sector_cod_sector">Codigo Sector: </label>
<input type="text" name="sector_cod_sector" class="form-input" required/>
<center> <input class="form-btn" name="submit" type="submit" value="Actualizar Institucion" /></center>
</form>
php:
<?php
$host = "localhost";
$user = "root";
$pw = "";
$db = "proyecto";
$con = mysqli_connect($host,$user,$pw, $db) or die("no se pudo conectar");
$cod_institucion = $_POST['cod_institucion'];
$nombre_institucion = $_POST['nombre_institucion'];
$sector_cod_sector = $_POST['sector_cod_sector'];
$actualizar = "UPDATE institucion set nombre_institucion = '$nombre_institucion', sector_cod_sector = '$sector_cod_sector' where cod_institucion = '$cod_institucion'";
$resultado =mysqli_query($con, $actualizar) or die("error al actualizar datos");
?>
update: the only error that the browser launches when executing the code is: Notice: Undefined index: code_institution in C: \ wamp64 \ www \ projects \ administrator \ update.php on line 9 I get that same error on lines 10 and 11
update: I made the print_r ($ _ POST); who recommended me, and throws me the following: Array ([cod_inst] = = pacos [cod_sector] = > 2 [submit] = > Update Institution)
The rest I do not understand, I've been trying to repair this for hours, with the data they gave me below and I can not make it work, I'm new to what is php with mysql.