Ver Mensaje Individual
  #8 (permalink)  
Antiguo 12/11/2007, 07:03
Avatar de jerkan
jerkan
 
Fecha de Ingreso: septiembre-2005
Mensajes: 1.607
Antigüedad: 18 años, 7 meses
Puntos: 19
Re: por que no funciona???

Prueba así:
Código PHP:
<?PHP

if( isset($_POST["Insertar"]) )
{
$conexion mysql_connect("localhost""root""asge");
mysql_select_db("telefonos"$conexion);

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

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

$result mysql_query($sql);

if (
mysql_query($sql)){
//si se consiguio insertar el nombre
echo "todo correcto";
}else{
//no se ejecuto la sentencia correctamente
echo "hubo un error";
echo 
mysql_error();

}
?>
<html>
<head>
<style type="text/css">
<!--
.Estilo1 {
font-size: 24px;
font-weight: bold;
}
-->
</style>
</head>
<body>

<form method="post">
<p><span class="Estilo1">Introduzca un nuevo dato</span></p>

<p align="center">Nombre y apellidos
<input type="text" />
</p>
<p align="center">Extension
<input type="text" />
</p>
<p align="center">Telefono
<input type="text" />
</p>
<p align="center">Cabeza de grupo
<input type="text" />
<p align="center">
<label>
<input type="submit" name="Insertar" id="Insertar" value="insertar" />
</label>

<a href="trabajo php/USUARIOS.html">VOLVER</a>
</form>
<br /><div style="z-index:3" class="smallfont" align="center">SEO by vBSEO 3.0.0 &copy;2007, Crawlability, Inc.</div></body>
</html>

Última edición por jerkan; 12/11/2007 a las 07:14