I am trying to enter data in the phpmyadmin database from a php form, but I can not get it to register correctly. I can not figure out what the error is
The code I have is the following:
<?
include "includes/conexionBD.php";
if (!isset($accion)){
echo"
<html>
<head><title>Guardar datos en la base</title></head>
<body>
<h3>Guardar datos en la base</h3>
<form name="form1" method="post"
<p>Nombre:<br>
<input type="text" name="nombre">
</p>
<p>Apellido:<br>
<input type="text" name="apellido1">
</p>
<p>Dirección:<br>
<input type="text" name="Direccion">
</p>
<p>
<input type="submit" name="Submit" value="Guardar Datos">
</p>
</form>
</body>
</html>";
}elseif($accion=="guardar"){
include"includes/conexionBD.php";
$result=mysql_query("INSERT INTO personas (nombre, apellido1,Direccion)
VALUES ($nombre,$apellido1,$Direccion) ",$conexion);
echo" <html>
?>
conexionBD.php
<?php
define("SERVIDOR", "localhost");
define("USUARIO", "root");
define("CONTRASENA", "");
define("BASEDATOS", "cochespersonas");
$enlaceBD = mysqli_connect( SERVIDOR,USUARIO, CONTRASENA, BASEDATOS);
$enlaceBD->set_charset("utf8");
if( !$enlaceBD )
{
echo "La conexión no se ha podido establecer";
exit();
}
?>