problema con form
Publicado por Ariel (12 intervenciones) el 02/02/2006 20:03:10
hola a todos.
tengo una pregunta que eh tratado hace rato pero no se la causa.
al ejecutar esto, presiono Guardar que es un "a href", ejecuta un javascript
para validar q todos los datos esten en el formulario
y si estan todos lo datos, que ejecute el script php llamado GuardaDatos(),
pero las variables me salen en blanco estas variables son de un form llamado
formulario_rc.
aqui tengo el codigo le quite varias cosas que se vea un poco mas claro.
agradecere su ayuda..
<html>
<head>
<script language="javascript" type="text/javascript">
function ValidaDatos(){
.......
<?php GuardaDato() ?>
}
</script>
<? php
function GuardaDato(){
list($dia,$mes,$anio) = explode("/",$fecharc);
$fecha = $anio."-".$mes."-".$dia;
$q ="INSERT INTO tab_rc";
$q .= " (FECHA_RC, GENERADOR, DESCRIPCION, ";
$q .= " RESP_B2, FECHA_B2, RESP_B3, FECHA_B3, ";
$q .= " RESP_B4, FECHA_B4, FECHA_SEG) ";
$q .= "VALUES";
$q .= " ('$fecha', '$nombre', '$descripcion', ";
$q .= " '$userbloque2', null, '$userbloque3' , null, ";
$q .= " '$userbloque4', null, null )";
$db=mysql_connect ("localhost", "root", "clave");
mysql_select_db("baseprueba", $db);
$result = mysql_query($q);
mysql_close($db);
}
?>
</head>
<body>
<a href="javascript:Nuevo()" id="gl1" class="glink" > Nuevo </a>
<a href="javascript:ValidaDatos()" title="Grabar" id="gl2" class="glink"> Grabar </a>
<a href="index.htm" id="gl3" class="glink"> Volver al Menú </a>
<form name="formulario_rc">
FECHA : <input type="text" name = "fecharc" maxlength="10" size="12"/>
NOMBRE : <input name="nombre" type="text" size="50" maxlength="50"><br>
</form>
</body>
</html>
tengo una pregunta que eh tratado hace rato pero no se la causa.
al ejecutar esto, presiono Guardar que es un "a href", ejecuta un javascript
para validar q todos los datos esten en el formulario
y si estan todos lo datos, que ejecute el script php llamado GuardaDatos(),
pero las variables me salen en blanco estas variables son de un form llamado
formulario_rc.
aqui tengo el codigo le quite varias cosas que se vea un poco mas claro.
agradecere su ayuda..
<html>
<head>
<script language="javascript" type="text/javascript">
function ValidaDatos(){
.......
<?php GuardaDato() ?>
}
</script>
<? php
function GuardaDato(){
list($dia,$mes,$anio) = explode("/",$fecharc);
$fecha = $anio."-".$mes."-".$dia;
$q ="INSERT INTO tab_rc";
$q .= " (FECHA_RC, GENERADOR, DESCRIPCION, ";
$q .= " RESP_B2, FECHA_B2, RESP_B3, FECHA_B3, ";
$q .= " RESP_B4, FECHA_B4, FECHA_SEG) ";
$q .= "VALUES";
$q .= " ('$fecha', '$nombre', '$descripcion', ";
$q .= " '$userbloque2', null, '$userbloque3' , null, ";
$q .= " '$userbloque4', null, null )";
$db=mysql_connect ("localhost", "root", "clave");
mysql_select_db("baseprueba", $db);
$result = mysql_query($q);
mysql_close($db);
}
?>
</head>
<body>
<a href="javascript:Nuevo()" id="gl1" class="glink" > Nuevo </a>
<a href="javascript:ValidaDatos()" title="Grabar" id="gl2" class="glink"> Grabar </a>
<a href="index.htm" id="gl3" class="glink"> Volver al Menú </a>
<form name="formulario_rc">
FECHA : <input type="text" name = "fecharc" maxlength="10" size="12"/>
NOMBRE : <input name="nombre" type="text" size="50" maxlength="50"><br>
</form>
</body>
</html>
Valora esta pregunta


0