Puse Igual todo y nada amigos... eso error me esta matando..! quisiera saber si la tabla del formulario esta bien???? miren la imagen de arriba:
id_cliente int (11) valor unico y auto increment.
Codigo Cliente varchar (50)
nombre varchar (50)
direccion varchar (50)
telefono (50)
rif (50)
aca esta como tengo el Codigo.! No se que pasara...!!! esto de conectarse a la base de datos es algo complicado.!
Código PHP:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" >
<title> INGRESAR DATOS CLIENTE</title>
<LINK REL="stylesheet" type="text/css" href="estilo.css" media="all" <div align="center"> <img src="r11.png" width="340" height="200" border="2" >
<body style="color:#000000;background-color:#ffe08f;" >
<script LANGUAGE="JAVASCRIPT">
function verifica(){
//validar el codigo
if (document.funcion.codigo.value==0)
{
alert("Debes Ingresar el Codigo Del cliente")
document.funcion.codigo.focus()
return 0;
}
//validar nombre
if (document.funcion.nombre.value==0)
{
alert("Debes Ingresar Nombre del cliente")
document.funcion.nombre.focus()
return 0;
}
//validar Direccion
if (document.funcion.direccion.value==0)
{
alert("Debes Ingresar La Direccion Del Cliente")
document.funcion.direccion.focus()
return 0;
}
//validar Telefono
if (document.funcion.telefono.value==0)
{
alert("Debes Ingresar El Telefono del Cliente")
document.funcion.telefono.focus()
return 0;
}
//validar Rif
if (document.funcion.rif.value==0)
{
alert("Debe Introducir El Rif Del Cliente.")
document.funcion.rif.focus()
return 0;
}
//el formulario se envia
alert("Muchas gracias por enviar el formulario");
document.funcion.submit();
document.funcion.opt.value=1;
}
</script>
</head>
<body>
<body>
<center><h1>INGRESO DE DATOS CLIENTE</h1>
<form method="POST" name="funcion" ACTION="procesar_cliente_formulario.php"
onSubmit="return verifica();">
<H3>DATOS PERSONALES</H3>
<H4>CODIGO DEL CLIENTE:</H4>
<input type="text" name="codigo" value=" " size="20"><br>
<FONT COLOR="#FF0000"> *CAMPO OBLIGATORIO </FONT><br>
<H4>NOMBRE COMPLETO:</H4>
<input type="text" name="nombre" value=" " size="20"><br>
<FONT COLOR="#FF0000"> *CAMPO OBLIGATORIO </FONT><br>
<H4>DIRECCION DEL CLIENTE:</H4>
<input type="text" name="direccion" value=" " size="20"><br>
<FONT COLOR="#FF0000"> *CAMPO OBLIGATORIO </FONT><br>
<H4>TELEFONO DEL CLIENTE:</H4>
<input type="text" name="telefono" value=" " size="20"><br>
<FONT COLOR="#FF0000"> *CAMPO OBLIGATORIO </FONT><br>
<h4>RIF</h4>
<input type ="text" name="rif" value=" " size="20"><br>
<FONT COLOR="#FF0000"> *CAMPO OBLIGATORIO </FONT><br>
</form>
</center>
<center>
<br>
<BR>
<tr>
<td colspan="2">
<p align="center"><input type="button" value="Enviar Datos" name="b3" onclick="verifica()">
</td>
</tr>
<p align="center"><input type="submit" name="borrar" value ="Borrar">
</center>
</head>
<body>
<?php
$codigo = $_POST["codigo"];
$nombre = $_POST["nombre"];
$direccion = $_POST["direccion"];
$telefono = $_POST["telefono"];
$rif = $_POST["rif"];
$conexion=mysql_connect("localhost","root","") or die ("error");
mysql_select_db("repuestosmotos",$conexion);
//Conectar a la base de datos (bd).
mysql_query("insert into clientes(codigo,nombre,direccion,telefono,rif) VALUES ('$codigo','$nombre','$direccion','$telefono','$rif')");
?>
</body>
</html>
:( me matare!