
Mostrar un mensaje de error en la misma pagina sin refrescar AYUDA!!!
Publicado por emir (1 intervención) el 25/01/2016 22:09:25
HOLA TENGO ESTE CODIGO HTML
MI PHP
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
</script>
<script src='https://www.google.com/recaptcha/api.js'></script>
</head>
<header>
<img src="img1/laley.png" alt="">
</header>
<nav >
</nav>
<body id="fondo">
<form action="enviar.php" method="post" class="contacto" onsubmit="return validar();">
<h2>Suscribete a nuestros BOLETINES</h2>
<input type="text" name="nombre" placeholder="Nombre y Apellidos" class="nombre" required>
<input type="email" name="correo" placeholder="Correo Electronico" class="correo" required>
<p>Seleccione Su Especialidad</P>
<table align="top" WIDTH=400 HEIGHT=200>
<tr>
<td align="left">
<label><input type="checkbox" name="tipo[]" value="Penal" /> Penal</label>
</td>
<td align="left">
<input type="checkbox" name="tipo[]" value="Laboral"/> Laboral
</td>
</tr>
<tr>
<td align="left">
<input type="checkbox" name="tipo[]" value="Civil"/> Civil
</td>
<td align="left">
<label><input type="checkbox" name="tipo[]" value="Constitucional"/> Constitucional</label>
</td>
</tr>
<tr>
<td align="left">
<input type="checkbox" name="tipo[]" value="Corporativo" /> Corporativo
</td>
<td align="left">
<input type="checkbox" name="tipo[]" value="Tributario"/> Tributario
</td>
</tr>
<tr>
<td align="left">
<input type="checkbox" name="tipo[]" value="Gubernamental"/> Gubernamental
</td>
<td align="left">
<input type="checkbox" name="tipo[]" value="Financiero"/> Financiero
</td>
</tr>
<tr>
<td align="left">
<input type="checkbox" name="tipo[]" value="Internacional"/> Internacional
</td>
<td align="left">
<input type="checkbox" name="tipo[]" value="Militar"/> Militar
</td>
</tr>
<tr>
<td align="left">
<input type="checkbox" name="tipo[]" value="Informatico"/> Informatico
</td>
<td align="left">
<input type="checkbox" name="tipo[]" value="Otro"/> Otro
</td>
</tr>
</table>
<!-- mensaje de error -->
<!-- fin error -->
<!-- re capcha -->
<div class="g-recaptcha" data-sitekey="6LfxERYTAAAAACA71ncTWC22jdOvda4PZge3HBtP"></div>
<!-- Fin de recaptcha -->
<br>
<input type="submit" value="ENVIAR" id="boton">
</form>
MI PHP
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
$captcha;
if (isset($_POST["nombre"])) {
$nombre = $_POST["nombre"];
}if (isset($_POST["correo"])) {
$correo = $_POST["correo"];
}if (isset($_POST["g-recaptcha-response"])) {
$captcha=$_POST['g-recaptcha-response'];
}
if (!$captcha) {
echo '<script language="javascript">
#error;
document.location='suscribete.html';
</script>';
exit;
}
$response=file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=aca esta mi codigos&response=".$captcha."&remoteip=".$_SERVER['REMOTE_ADDR']);
if ($response.success==false) {
echo '<script language="javascript">
alert("Eres SPAM");
</script>';
}else{
echo '<script language="javascript">
alert("Gracias por SUSCRIBIRTE");
</script>';
}
/* CORREO DESTINO*/
$destino = "aca hay un correo";
/* par el checkbox */
$host_plan = $_POST['radio_group_1'];
$additional_options = implode(' | ', $_POST['tipo']);
$host_period = $_POST['dropdown'];
$contenido = "Se suscribio el Dr(a): " . $nombre . "\nCorreo: " . $correo . "\nDesea recibir los sgts. BOLETINES: " . $additional_options;
mail($destino, $correo, $contenido);
header("Location:gracias.html");
echo '<meta http-equiv="REFRESH"content="1; url=ACAHAY UNAURL">';
?>
Valora esta pregunta


-1