Ver Mensaje Individual
  #1 (permalink)  
Antiguo 09/11/2007, 05:41
francibj
 
Fecha de Ingreso: noviembre-2007
Mensajes: 51
Antigüedad: 16 años, 5 meses
Puntos: 0
Pregunta Envio de datos de un formulario a una base de datos

Hola soy nuevo aqui, a ver si me podeis alludar:
Estoy intentando insertar datos en una base de datos a traves de un formulario pero despues de hacerlo de 1000 formas diferentes me dan errores o simplemente no me aparecen los datos en la base.Dejo el codigo:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Documento sin t&iacute;tulo</title>
</head>

<body>

<div align="left">
<?php

if ($enviar) {

// process form

$link = mysql_connect("localhost", "root", "asge");

mysql_select_db("telefonos",$db);

$sql = "INSERT INTO telefonos_datos (NOMBRE, EXTEN_MOVIL, TLFNO, CABEZA DE GRUPO) ";

$sql .= "VALUES ('".$nombre."', '".$extension."', '".$telefono."', '".$cabeza_grupo."')";

$result = mysql_query($sql);

echo "¡Gracias! Hemos recibido sus datos.\n";

}else{

?>

</div>
<form method="post" action=<"$result">

<div align="left">Nombre Apellidos:
<input type="Text" name="nombre">
<br>

Extensión:
<input type="Text&quo>Dirección:<input type="Text" name="extension">
<br>

Teléfono :
<input type="Text" name="telefono">
<br>

Cabeza de grupo :
<input type="Text" name="Cabeza de grupo">
<br>

<input type="Submit" name="enviar" value="Aceptar información">

</div>
</form>


<div align="left">
<?php

} //end if

?>


</div>
</body>
</html>