Código PHP:
function enviaForm() {
var objTable =document.getElementById("registros");//objTBody.parentNode;
nextCod=objTable.rows.length-1;
var validezFormulario=true;
for(i=1;i<=(nextCod-1);i++)
{
var validezFormularioTemp=true;
validezFormularioTemp=validaRow(i);
validezFormulario*=validezFormularioTemp;
//alert("validaRow("+i+") : "+validezFormularioTemp);
if(!validezFormulario)
return ;
}
if (document.form1.nombre.value.length==0) {
alert('Por favor ingrese su Nombre');
document.form1.nombre.focus()
return;
}
if (document.form1.rut.value == '') {
alert('Por favor ingrese su R.U.T.');
return;
}
if (document.form1.direccion.value == '') {
alert('Por favor ingrese su direccion');
return;
}
if (document.form1.ciudad.value == '') {
alert('Por favor ingrese su Ciudad');
return;
}
if (document.form1.telefono.value == '') {
alert('Por favor ingrese su telefono');
return;
}
if (document.form1.mail.value == '') {
alert('Por favor ingrese su email');
return;
}
if (!(isEMail(document.form1.mail.value == '') {
alert('Debe ingresar un email valido');
return;
}
if (document.form1.transporte.value == '') {
alert('Por favor ingrese un transporte');
return;
}
document.form1.submit();
};
</script>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="document.getElementById('cantidad1').value='';loadAddresses();sortlist('codigo1');" bgcolor="#FFFFFF";>
<form action="mandaformulario.php" method="post" name="form1" >
<!--
onKeypress="if(event.keyCode == 13) event.returnValue = false;"
-->
<table width="100%" border="0">
<tr>
<td height="23" colspan="4"><font color="#660033" size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>SOLICITUD
DE PEDIDO ( * Campos Obligatorios ) <em><br>
<br>
<br>
</em></strong></font></td>
</tr>
<?php
if(isset($_GET["nombre"]))
{ $nombre = $_GET["nombre"]; }
else
{ $nombre = ""; }
if(isset($_GET["rut"]))
{ $rut = $_GET["rut"]; }
else
{ $rut = ""; }
if(isset($_GET["direccion"]))
{ $direccion = $_GET["direccion"]; }
else
{ $direccion = ""; }
if(isset($_GET["ciudad"]))
{ $ciudad = $_GET["ciudad"]; }
else
{ $ciudad = ""; }
if(isset($_GET["telefono"]))
{ $telefono = $_GET["telefono"]; }
else
{ $telefono = ""; }
if(isset($_GET["mail"]))
{ $mail = $_GET["mail"]; }
else
{ $mail = ""; }
if(isset($_GET["transporte"]))
{ $transporte = $_GET["transporte"]; }
else
{ $transporte = ""; }
?>
<tr>
<td width="77" height="21" valign="top"><font color="#660033" size="2" face="Verdana, Arial, Helvetica, sans-serif">Nombre *</font></td>
<td width="180" height="21" valign="top"><input name="nombre" type="text" id="nombre" size="30" value="<?php echo $nombre; ?>"></td>
<td width="75" height="21" valign="top"><font color="#660033" size="2" face="Verdana, Arial, Helvetica, sans-serif">Rut *</font></td>
<td width="400" height="21" valign="top">
<input name="rut" type="text" id="rut" size="20" onBlur="javascript:Rut(document.form1.rut.value);" value="<?php echo $rut; ?>">
<font color="#660033" size="2" face="Verdana, Arial, Helvetica, sans-serif">(Sin puntos ni guion)</font>
</td>
</tr>
<tr>
<td width="77" height="21" valign="top"><font color="#660033" size="2" face="Verdana, Arial, Helvetica, sans-serif">Dirección *</font></td>
<td width="180" height="21" valign="top"><input name="direccion" type="text" id="direccion" size="30" value="<?php echo $direccion; ?>"</td>
<td width="75" height="21" valign="top"><font color="#660033" size="2" face="Verdana, Arial, Helvetica, sans-serif">Ciudad *</font></td>
<td width="400" height="21" valign="top"><input name="ciudad" type="text" id="ciudad" size="30" value="<?php echo $ciudad; ?>"></td>
</tr>
<tr>
<td width="77" height="21" valign="top"><font color="#660033" size="2" face="Verdana, Arial, Helvetica, sans-serif">Teléfono *</font></td>
<td width="180" height="21" valign="top"><input name="telefono" type="text" id="telefono" size="15" value="<?php echo $telefono; ?>"></td>
<td width="75" height="21" valign="top"><font color="#660033" size="2" face="Verdana, Arial, Helvetica, sans-serif">Email *</font></td>
<td width="400" height="21" valign="top"><input name="mail" type="text" id="mail" size="30" value="<?php echo $mail; ?>"></td>
</tr>
<tr>
<td height="3"><font color="#660000" size="2" face="Verdana, Arial, Helvetica, sans-serif">Transporte *
</font></td>
<td><input name="transporte" type="text" id="transporte" size="30" value="<?php echo $transporte; ?>"></td>
<td> </td>
<td> </td>
</tr>