- Tema Autor
- #1
Hola que tal!!
Soy nuevo en el lenguaje de programacion PHP!!
Porfa me pueden decir en que estoy mal y como lo soluciono??, pero en lenguaje no muy tecnico ya que soy nuevo les repito!!
Estoy realizando un pequeño formulario, a continuacion muestro el codigo que estoy utilizando:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title></title>
</head>
<body>
<form action="index.php" method="POST">
Nombre:
<input type="text" name="nombre"><br>
Direccion:
<input type="text" name="direccion"><br>
Telefono:
<input type="text" name="telefono" maxlength="10"><br>
<input type="submit" value="registrar" name="altas">
</form>
<?php
$conexion= mysql_connect("localhost","root","") or die("Problema en la conexion");
mysql_select_db("ejemplo",$conexion) or die("Problemas en la seleccion de base de datos");
mysql_query("insert into clientes(nombre,direccion,telefono) values
('$_REQUEST[nombre]','$_REQUEST[direccion]',$_REQUEST[telefono])",
$conexion) or die("Problemas en el select".mysql_error());
mysql_close($conexion);
echo "El cliente fue dado de alta.";
?>
</body>
</html>
Y me manda los siguientes errores:
Notice: Undefined index: nombre in C:\xampp\htdocs\Ejemplo1\index.php on line 23
Notice: Undefined index: direccion in C:\xampp\htdocs\Ejemplo1\index.php on line 23
Notice: Undefined index: telefono in C:\xampp\htdocs\Ejemplo1\index.php on line 23
Problemas en el selectYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 2
Muchas gracias por su ayuda!!
Saludos
Soy nuevo en el lenguaje de programacion PHP!!
Porfa me pueden decir en que estoy mal y como lo soluciono??, pero en lenguaje no muy tecnico ya que soy nuevo les repito!!
Estoy realizando un pequeño formulario, a continuacion muestro el codigo que estoy utilizando:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title></title>
</head>
<body>
<form action="index.php" method="POST">
Nombre:
<input type="text" name="nombre"><br>
Direccion:
<input type="text" name="direccion"><br>
Telefono:
<input type="text" name="telefono" maxlength="10"><br>
<input type="submit" value="registrar" name="altas">
</form>
<?php
$conexion= mysql_connect("localhost","root","") or die("Problema en la conexion");
mysql_select_db("ejemplo",$conexion) or die("Problemas en la seleccion de base de datos");
mysql_query("insert into clientes(nombre,direccion,telefono) values
('$_REQUEST[nombre]','$_REQUEST[direccion]',$_REQUEST[telefono])",
$conexion) or die("Problemas en el select".mysql_error());
mysql_close($conexion);
echo "El cliente fue dado de alta.";
?>
</body>
</html>
Y me manda los siguientes errores:
Notice: Undefined index: nombre in C:\xampp\htdocs\Ejemplo1\index.php on line 23
Notice: Undefined index: direccion in C:\xampp\htdocs\Ejemplo1\index.php on line 23
Notice: Undefined index: telefono in C:\xampp\htdocs\Ejemplo1\index.php on line 23
Problemas en el selectYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 2
Muchas gracias por su ayuda!!
Saludos