La parte Java:
Código:
La parte PHP + Formulario:<script language="JavaScript"> <!-- function SymError() { return true; } window.onerror = SymError; var SymRealWinOpen = window.open; function SymWinOpen(url, name, attributes) { return (new Object()); } window.open = SymWinOpen; //--> function CheckRequiredFields() { var errormessage = new String(); // Put field checks below this point. if(WithoutContent(document.order.name.value)) { errormessage += "\n\nPor favor ingrese su Nombre."; } if(WithoutContent(document.order.email.value)) { errormessage += "\n\nPor favor ingrese su Email."; } if(WithoutCheck(document.order.politicas)) { errormessage += "\n\nUsted debe aceptar las Condiciones y Términos de las POLÍTICAS DE RENTA."; } // Put field checks above this point. if(errormessage.length > 2) { alert('NOTA:' + errormessage); return false; } return true; } // end of function CheckRequiredFields() function WithoutContent(ss) { if(ss.length > 0) { return false; } return true; } function NoneWithContent(ss) { for(var i = 0; i < ss.length; i++) { if(ss[i].value.length > 0) { return false; } } return true; } function NoneWithCheck(ss) { for(var i = 0; i < ss.length; i++) { if(ss[i].checked) { return false; } } return true; } function WithoutCheck(ss) { if(ss.checked) { return false; } return true; } function WithoutSelectionValue(ss) { for(var i = 0; i < ss.length; i++) { if(ss[i].selected) { if(ss[i].value.length) { return false; } } } return true; } //--> </script>
Código:
<? if (isset($_POST['isOK'])) { function checkString($s) { $s = str_replace("<","<",$s); $s = str_replace("'","''",$s); $s = str_replace(chr(13),"<br>",$s); return $s; } $name=checkString($_POST['name']); $email=checkString($_POST['email']); $car=checkString($_POST['car']); $inicio=checkString($_POST['inicio']); $fin=checkString($_POST['fin']); $comments=checkString($_POST['comments']); $politicas=checkString($_POST['politicas']); $to= "[email protected]"; $subject= "aaa"; $messageSend= "<b>N:</b> ".$name." <br>"; $messageSend.= "<b>E:</b> ".$email." <br>"; $messageSend.= "<b>T:</b> ".$car." <br>"; $messageSend.= "<b>Inicio:</b> ".$inicio." <br>"; $messageSend.= "<b>Final:</b> ".$fin." <br>"; $messageSend.= "<b>Acepto las Politicas de Renta:</b> ".$politicas." <br>"; $messageSend.= "<b>C:</b> ".$comments." <br>"; $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html; charset=utf-8\r\n"; $headers .= "From: ME <[email protected]>\r\n"; $headers .= "Reply-To: ".$email."\r\n"; mail($to, $subject, $messageSend, $headers); ?> Gracias por su reservacion <? } else { ?><form action="reservaciones.php" method="post" name="order" id="order" style="margin:2px 0 0 0;" onSubmit="return CheckRequiredFields()"><table width="279" style="height:100px;" cellpadding="0" cellspacing="0" border="0"> <tr> <td width="279" style="height:41px;"><p style="margin:0 0 0 26px;" class="z_1">TIPO DE AUTO:</p> <table width="254" style="height:12px; margin:2px 0 0 22px;" cellpadding="0" cellspacing="0" border="0"> <tr> <td width="18" style="height:12px;"><input name="car" type="radio" class="ch" style="width:12px; height:12px;" value="Sedan" checked="checked"/></td> <td width="60" style="height:12px;"><p style="margin:0px 0 0 5px; padding:0 0 5px 0;">Sedán</p></td> <td width="18" style="height:12px;"><input name="car" type="radio" class="ch" style="width:12px; height:12px;" value="Microbus" /></td> <td width="158" style="height:12px;"><p style="margin:0px 0 0 5px; padding:0 0 5px 0;">Microbus</p></td> </tr> </table></td> </tr> <tr> <td width="279" style="height:1px;"><p style="margin:0 0 0 0;"><img src="images/line_1.jpg" alt="" width="279" height="1" style="margin:0 0 0 0;" /></p></td> </tr> <tr> <td width="279" style="height:120px;"> <table width="279" style="height:120px;" cellpadding="0" cellspacing="0" border="0"> <tr> <td width="279" height="32" style="height:31px;"> <table style="height:12px; margin:6px 0 0 26px;" cellpadding="0" cellspacing="0" border="0"> <tr> <td width="213" style="height:12px;"><p style="margin:2px 0 0 ; padding:0 0 5px 0;" class="z_1">NOMBRE COMPLETO</p> </td> </tr> </table></td> </tr> <tr> <td width="279" style="height:20px;"> <table width="279" style="height:20px;" cellpadding="0" cellspacing="0" border="0"> <tr> <td width="137" style="height:20px;"><input type="text" name="name" style="width:137px; height:17px; margin:0 0 0 26px;" id="name" /></td> <td width="142" style="height:20px;"><p style="margin:2px 0 0 9px;"><a href="#" class="more_1">Igual que en su ID</a></p></td> </tr> </table></td> </tr> <tr> <td width="279" height="69" style="height:69px;"> <table width="192" style="height:54px;" cellpadding="0" cellspacing="0" border="0"> <tr> <td width="192" style="height:18px;"><table width="192" style="margin: 4px 0 0 26px;" cellpadding="0" cellspacing="0" border="0"><tr> <td width="17"><input name="mayor" type="checkbox" class="ch" id="mayor" style="height:12px; margin:2px 5px 0 0; width:12px" value="Si" /></td> <td width="166"><p style="margin:0 0 0 0;"><span>Soy mayor de 25 años</span></p></td> </tr> </table></td> </tr> <tr> <td width="192" style="height:18px;"><table width="192" style="margin: 4px 0 0 26px;" cellpadding="0" cellspacing="0" border="0"><tr> <td width="17"><input name="politicas" type="checkbox" class="ch" id="politicas" value="Si" style="height:12px; margin:2px 5px 0 0; width:12px"></td> <td width="166"><p style="margin:0 0 0 0; padding:0 0 5px 0;"><span>He leído y estoy de acuerdo con las <a href="condiciones.html" target="_blank">Políticas de Renta</a></span></p></td> </tr> </table></td> </tr> </table></td> </tr> </table></td> </tr> <tr> <td width="279" style="height:1px;"><p style="margin:0 0 0 0;"><img src="images/line_1.jpg" alt="" width="279" height="1" style="margin:0 0 0 0;" /></p></td> </tr> <tr> <td width="279" style="height:100px;"> <table width="213" style="height:80px; margin:7px 0 0 26px" cellpadding="0" cellspacing="0" border="0"> <tr> <td width="213" style="height:21px;"><p style="margin:2px 0 0 ;" class="z_1">FECHAS DE RENTA</p></td> </tr> <tr> <td width="213" style="height:16px;"> <table width="213" style="height:16px;" cellpadding="0" cellspacing="0" border="0"> <tr> <td width="110" style="height:16px;"><p style="margin:0 0 0 0;">Inicio (dd/mm/yyyy)</p></td> <td width="103" style="height:16px;"><p style="margin:0 0 0 0;">Final (dd/mm/yyyy)</p></td> </tr> </table></td> </tr> <tr> <td width="213" style="height:24px;"><table width="190" style="height:16px;" cellpadding="0" cellspacing="0" border="0"> <tr> <td width="112" style="height:16px;"><input type="text" style="width:82px; height:16px" align="left" name="inicio" id="inicio" /></td> <td width="82" style="height:16px;"><input type="text" style="width:82px; height:16px; margin:0 0 0 0;" name="fin" id="fin" /></td> </tr> </table></td> </tr> <tr> <td width="213" style="height:19px;"> </td> </tr> </table></td> </tr> <tr> <td width="279" style="height:1px;"><p style="margin:0 0 0 0;"><img src="images/line_1.jpg" alt="" width="279" height="1" style="margin:0 0 0 0;" /></p></td> </tr> <tr> <td width="279" style="height:84px;"> <table width="190" style="height:74px; margin:10px 0 0 26px;" cellpadding="0" cellspacing="0" border="0"> <tr> <td width="190" style="height:13px;"><p style="margin:0 0 0 0;">Mensaje:</p></td> </tr> <tr> <td width="190" style="height:35px;"> <table width="190" style="height:35px; margin:0 0 0 0; padding:0 0 10px 0;"cellpadding="0" cellspacing="0" border="0"> <tr> <td width="141" style="height:35px;"><textarea name="comments" id="comments" cols="45" rows="5"></textarea></td> </tr> </table></td> </tr> <tr> <td width="74" nowrap class="align_right" style="height:9px"><div style="margin:10px 0 0 0px;"> <img src="images/1_str.jpg" alt="" width="3" height="6" style="margin:0px 5px 0 0;" /> <input type="submit" name="submit" id="button" value="Enviar"> </div></td> </tr> </table></td> </tr> </table> <input type="hidden" name="isOK" value="OK"> </form> <? } ?>