Hola;haber si me podeis echar una mano,aquí os pongo este archivo
Por que no funciona?
<?php
//Conexion con la base de datos
function open_db_connection(){
$link = mysql_connect('localhost', 'root', '');
if (!$link) {
die('No se pudo establecer conexion con el servidor de base de datos : ' . mysql_error());
}
$db_selected = mysql_select_db('registro', $link);
if (!$db_selected) {
die ('No se puede utilizar la base de datos test : ' . mysql_error());
}
}
function guardar_datos()
{
$nombre=$_POST['nombre'];
$email=$_POST['email'];
$apellido=$_POST['apellido'];
$sqlInsert='INSERT INTO cliente (clave, nombre, apellido, email) VALUES ("","'.$nombre.'","'.$apellido.'","'.$email.'") ';
mysql_query($sqlInsert);
}
if( isset($_POST['nombre']) && !empty($_POST['nombre']) && isset($_POST['apellido']) && !empty($_POST['apellido']) && isset($_POST['email']) && !empty($_POST['email']) )
{
open_db_connection();
guardar_datos();
}
?>
<html>
<head>
<title>registro</title>
</head>
<body>
<form name="cliente" method="post" action="">
<label>Tu nombre:</label> <input type="text" name="nombre" maxlength="100"><br/>
<label>Tu apellido:</label> <input type="text" name="apellido" maxlength="100"><br/>
<label>Tu E-Mail:</label> <input type="text" name="email" maxlength="150"><br/>
<input type="submit" value="Dar de alta">
</form>
</body>
</html>