I saw several details in your code and I passed the following script to you; give it a try and stay tuned for your comments:
<?php
session_start();
$conexion = new mysqli("localhost", "root", "", "lista");
if ($conexion->connect_error) {
die("Connection failed: " . $conexion->connect_error);
}
$id = $_POST['id']; $agencia = $_POST['agencia']; $depa = $_POST['departamento']; $area = $_POST['area']; $nombre = $_POST['nombre']; $ext = $_POST['extencion'];
$sql = "UPDATE lista SET id='".$id."', agencia='".$agencia."', departamento='".$depa."', area='".$area."', nombre='".$nombre."',extencion='".$ext."' where id='".$id"'";
if($conexion->query($sql)){
echo "Modificado con éxito";
}else{
echo "No modificado";
}
How you can notice the syntax for your variables should be '".$variable."'
I also recommend that your variable that stores the connection does not name the same as the driver you are using, that is to say mysqli, I will change it for $ connection and it should continue working.