Good morning, I am practicing with PHP and postgresql to do a project for the university and I have not been able to update a table in the BD for two days. I've been changing the syntax reading solutions in different forums and I do not know what it could be :(, I already have everything I need to start developing but as long as I can not update the BD I can not start the project. I appreciate your help.
OS: Ubuntu 16.04
<form action="agregar.php" method="post">
<p>nombre del switch: <input type="text" name="nombre" /></p>
<p>puerto: <input type="text" name="puerto" /></p>
<p>vlan:<input type="vlan" /></p>
<input type="submit" name="insertar" value="insertar">
</form
add file
<?php
include('conexion.php');
$nombre=pg_escape_literal($_POST['nombre']);
$puerto=pg_escape_literal($_POST['puerto']);
$vlan=pg_escape_literal($_POST['vlan']);
$query= "INSERT INTO switches (nombre, puerto, vlan) VALUES ('$nombre', '$puerto', '$vlan' )";
$res = pg_query($query);
?>
connection to the BD
<?php
$dbconn= pg_connect("host=localhost dbname=centro_de_datos user=postgres password=admin")
or die ('No se puede conectar a la BD'. pg_last_error());
?>