I am making a form through which you insert some data and these must be inserted in the database, but when I give it to send I get it:
undefined index: id (for all id, description, ...)
What am I doing wrong?
data connection is where I have
<?php
$dsn="mysql:dbname=ejemplo9;host=localhost";
$usuario=...
$contrasena=...
?>
The php code is this:
<html>
<body>
<?php
include("datosconexion.php");
$id=$_POST['id'];
$descripcion=$_POST['descripcion'];
$pvp=$_POST['pvp'];
$stock=$_POST['stock'];
$consulta="INSERT INTO articulo
(id,descripcion,pvp,stock) VALUES('$id','$descripcion,'$pvp','$stock')";
if(mysqli_query($link,$consulta)){
echo " Datos insertados";
}else{
echo "Datos NO insertados";
}
?>
</body>
</html>
Form:
<html>
<body>
<form method="post" action="conexionagregar5.php">
<p>Ingresa los datos</p>
<p>Escribe el identificador del articulo</p>
<input type="text" name "id_articulo">
<p>Escribe la descripcion del articulo</p>
<input type="text" name "descripcion">
<p>Escribe el precio del articulo</p>
<input type="text" name "pvp">
<p>Escribe si hay stock del articulo</p>
<input type="text" name "stock">
<input type="submit" value="Guardar datos" name="Enviar">
</form>
</body>
</html>