I have a problem with my page, I'm sure it's something very simple but I'm not realizing where I have the error. The problem is that the contact form does not work, I get the following error:
"Error"
The link on my page is link
And here I attach my HTML code:
<form name="contactform" method="post" action="mail/gs_enviar.php">
<table>
<tr>
<td valign="top">
<label for="name">Nombre Y Apellido *</label>
</td>
<td valign="top">
<input type="text" name="name" maxlength="50" size="30">
</td>
</tr>
<tr>
<td valign="top">
<label for="email">E-mail *</label>
</td>
<td valign="top">
<input type="text" name="email" maxlength="50" size="30">
</td>
</tr>
<tr>
<td valign="top">
<label for="telefono">Telefono *</label>
</td>
<td valign="top">
<input type="text" name="telefono" maxlength="50" size="30">
</td>
</tr>
<tr>
<td valign="top">
<label for="comunidad">Nombre de la Comunidad *</label>
</td>
<td valign="top">
<input type="text" name="comunidad" maxlength="30" size="30">
</td>
</tr>
<tr>
<td valign="top">
<label for="usuario">Usuario del Panel *</label>
</td>
<td valign="top">
<input type="text" name="usuario" maxlength="30" size="30">
</td>
</tr>
<tr>
<td valign="top">
<label for="pass">Contraseña del Panel *</label>
</td>
<td valign="top">
<input type="text" name="pass" maxlength="30" size="30">
</td>
</tr>
<tr>
<td valign="top">
<label for="juegos">Seleccionar Juego *</label>
</td>
<td valign="top">
<select name="juegos">
<option>-- Seleccionar --</option>
<option>Counter Strike 1.6 100FPS</option>
<option>Counter Strike 1.6 300FPS</option>
<option>Counter Strike 1.6 500FPS</option>
<option>Counter Strike 1.6 1000FPS</option>
<option>Counter Strike GO - 64TICKRATE</option>
<option>Counter Strike GO - 128TICKRATE</option>
<option>Counter Strike Source - 64TICKRATE</option>
<option>Counter Strike Source - 128TICKRATE</option>
<option>Team Fortress Classic</option>
<option>SAMP</option>
<option>Left 4 Dead</option>
<option>Mu Online</option>
<option>Wow</option>
<option>Minecraft</option>
</select>
</td>
</tr>
<tr>
<td valign="top">
<label for="pagos">Formas de Pago *</label>
</td>
<td valign="top">
<select name="pagos">
<option>-- Seleccionar --</option>
<option>Rapipago</option>
<option>Pago Facil</option>
<option>Transferencia</option>
<option>Bapro</option>
<option>Cuenta Digital</option>
<option>Dinero Mail</option>
</select>
</td>
</tr>
<tr>
<td valign="top">
<label for="branding">Quitar Branding 50$ (By rnkhost.net) *</label>
</td>
<td valign="top">
<select name="branding">
<option>-- Seleccionar --</option>
<option>Si</option>
<option>No</option>
</select>
</td>
</tr>
<td>
<p> En el mensaje ingresar Server - Cantidad de Slot</p>
Ejemplo:
<p> Server 1: 12 slot</p>
<p> Server 2: 14 slot </p>
<p> Server 3: 16 slot </p>
</td>
<tr>
<td valign="top">
<label for="message">Mensaje *</label>
</td>
<td valign="top">
<textarea name="message" maxlength="1000" cols="25" rows="6"></textarea>
</td>
</tr>
<tr>
<td colspan="2">
<br>
<div class="g-recaptcha" data-sitekey="6LfrGS8UAAAAAM1aPxprLtJSdfrOxRa1A5icy_A6"></div>
<br>
<input type="submit" value="Enviar"></a>
</td>
</tr>
</table>
</form>
And here I leave the gs_enviar.php that would be:
<?php
if(isset($_POST['email'])) {
//
$email_to = "[email protected]";
$email_subject = "Web - GameServer";
function died($error) {
// mensajes de error
echo "Lo sentimos, hubo un error en sus datos y el formulario no puede ser enviado en este momento. ";
echo "Detalle de los errores.<br /><br />";
echo $error."<br /><br />";
echo "Por favor corrija estos errores e inténtelo de nuevo.<br /><br />";
die();
}
// Se valida que los campos del formulairo estén llenos
if(!isset($_POST['name']) ||
!isset($_POST['email']) ||
!isset($_POST['telefono']) ||
!isset($_POST['comunidad']) ||
!isset($_POST['usuario']) ||
!isset($_POST['pass']) ||
!isset($_POST['juegos']) ||
!isset($_POST['pagos']) ||
!isset($_POST['branding']) ||
!isset($_POST['message'])) {
died('Lo sentimos pero parece haber un problema con los datos enviados.');
}
//En esta parte el valor "name" sirve para crear las variables que recolectaran la información de cada campo
$name = $_POST['name']; // requerido
$email_from = $_POST['email']; // requerido
$telefono = $_POST['telefono']; // requerido
$comunidad = $_POST['comunidad']; // requerido
$usuario = $_POST['usuario']; // requerido
$pass = $_POST['pass']; // requerido
$juegos = $_POST['juegos']; // requerido
$pagos = $_POST['pagos']; // requerido
$branding = $_POST['branding']; // requerido
$message = $_POST['message']; // requerido
$error_message = "";//Linea numero 52;
//En esta parte se verifica que la dirección de correo sea válida
$email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/';
if(!preg_match($email_exp,$email_from)) {
$error_message .= 'La direccion de correo proporcionada no es valida.<br />';
}
//En esta parte se validan las cadenas de texto
$string_exp = "/^[A-Za-z .'-]+$/";
if(!preg_match($string_exp,$name)) {
$error_message .= 'El formato del nombre no es valido<br />';
}
if(strlen($message) > 2) {
$error_message .= 'El formato del texto no es valido.<br />';
}
if(strlen($error_message) > 0) {
die($error_message);
}
//Este es el cuerpo del mensaje tal y como llegará al correo
$email_message = "Contenido del Mensaje.\n\n";
function clean_string($string) {
$bad = array("content-type","bcc:","to:","cc:","href");
return str_replace($bad,"",$string);
}
$email_message .= "Nombre: ".clean_string($name)."\n";
$email_message .= "Email: ".clean_string($email_from)."\n";
$email_message .= "Telefono: ".clean_string($telefono)."\n";
$email_message .= "Comunidad: ".clean_string($comunidad)."\n";
$email_message .= "Usuario: ".clean_string($usuario)."\n";
$email_message .= "Password: ".clean_string($pass)."\n";
$email_message .= "Juegos: ".clean_string($juegos)."\n";
$email_message .= "Pagos: ".clean_string($pagos)."\n";
$email_message .= "Branding: ".clean_string($branding)."\n";
$email_message .= "Mensaje: ".clean_string($message)."\n";
//Se crean los encabezados del correo
$headers = 'From: '.$email_from."\r\n".
'Reply-To: '.$email_from."\r\n" .
'X-Mailer: PHP/' . phpversion();
@mail($email_to, $email_subject, $email_message, $headers);
?>
<!-- Mensaje de que fue enviado-->
Gracias! Nos pondremos en contacto contigo a la brevedad
<?php
}
?>