Ver Mensaje Individual
  #1 (permalink)  
Antiguo 18/04/2011, 21:15
JenderxD
 
Fecha de Ingreso: abril-2011
Mensajes: 52
Antigüedad: 13 años
Puntos: 0
Pregunta Error al Enviar Formulario A Base de Datos

buenas noches amigos. mi problema es el siguiente me estoy adentrando en el mundo de la programacion ya que en la universidad me dan esta materia pero tube que faltar algunos dias por una pequeña enfermedad y ese dia explicaron cosas que eran importante. quisiera q me hechen una manito..!

No puedo enviar el formulario creado a la base de datos..! me sale error en las ultimas lineas del VALUE cuando uno llama (insert into tabla() value(aca me da el error)..

Aca dejo el codigo.! Estoy Utilizando Netbeans con servidor apache para windows. necesito ayuda..

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"
              onSubmit="return verifica();">
        
        <H3>DATOS PERSONALES</H3>
        <H4>CODIGO DEL CLIENTE:</H4>
        <input type="text" name ="codigo" value=" " size="20"><br>
        <FONT COLOR="#FF0000">&nbsp;*CAMPO OBLIGATORIO &nbsp;</FONT><br>
        <H4>NOMBRE COMPLETO:</H4>
        <input type="text" name ="nombre" value=" " size="20"><br>
        <FONT COLOR="#FF0000">&nbsp;*CAMPO OBLIGATORIO &nbsp;</FONT><br>
        <H4>DIRECCION DEL CLIENTE:</H4>
        <input type="text" name ="direccion" value=" " size="20"><br>
        <FONT COLOR="#FF0000">&nbsp;*CAMPO OBLIGATORIO &nbsp;</FONT><br>
        <H4>TELEFONO DEL CLIENTE:</H4>
        <input type="text" name ="telefono" value=" " size="20"><br>
        <FONT COLOR="#FF0000">&nbsp;*CAMPO OBLIGATORIO &nbsp;</FONT><br>
        <h4>RIF</h4>
        <input type ="text" name="rif" value=" " size="20"><br>
        <FONT COLOR="#FF0000">&nbsp;*CAMPO OBLIGATORIO &nbsp;</FONT><br>

        </form>
        </center>
        <input type="hidden" name="opt">
            <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 
$_REQUEST["codigo"];
        
$nombre $_REQUEST["nombre"];
        
$direccion $_REQUEST["direccion"];
        
$telefono $_REQUEST["telefono"];
        
$rif $_REQUEST["rif"];

        
$conexion=mysql_connect("localhost","root")
                or die (
"Error al realizar la conexion");
        
mysql_select_db("clientes",$conexion);

       
//Conectar a la base de datos (bd).
$instruccion="insert into empleado (noemp,nombre,apellido,salario)
values ('.$codigo.','.$nombre.','.$direccion.','.$telefono.','.$rif.')"
;

        
?>
    </body>
</html>