Hola a todos: recien estoy haciendo un formulario en php que cuando ingresan los datos son enviados directamente a una cuenta de correo.
Lo que me gustaria es que el usuario llene los campos sin enviarme campos obligatorios en blanco como el nombre,etc.
Haber si me dan una mano y desde ya muchas gracias.
Codigo PHP eventos.php
Cita: Código HTML:
<form name="contactos" method="post" action="<?php echo $PHP_SELF; ?>">
<div align="center">
<?php
if(isset($contacto))
{
?>
<span class="Tahoma11BoldTituloCaracteristicas">Tu mensaje ha sido enviado con éxito. </span></div>
<table width="376" border="0" align="center">
<tr>
<td width="405" class="Tahoma11BoldTituloCreditos"><div align="center">Tu opinión es muy importante para seguir mejorando: </div></td>
</tr>
</table>
<?php
$email = "[email protected]";
mail($email,"Pedidos de las Empresas - Web Canela Fina",
"<html><i>Este email ha sido generado en base al formulario en bcpo.com.pe</i><br>".
"<br><b>Empresa:</b> $empresa<br>".
"<b>Persona de Contacto:</b> $persona<br>".
"<b>Direccion:</b> $direccion<br>".
"<b>País:</b> $pais<br>".
"<b>Ciudad:</b> $ciudad<br>".
"<b>Email:</b> $user_email<br>".
"<b>Teléfono:</b> $tel<br>".
"<b>Pedido:</b> $pedido<br>",
"MIME-Version: 1.0\r\nContent-type: text/html; charset=iso-8859-1\r\n");
unset($empresa);
unset($persona);
unset($tel);
unset($user_email);
unset($direccion);
unset($pais);
unset($ciudad);
unset($pedido);
}
?>
<table width="376" border="1" align="center" bordercolor="#DC953D" background="img/fondo_principal.jpg">
<tr>
<td width="69" class="Tahoma11BoldTextoCaracteristicas">Empresa:</td>
<td width="291"><center><label>
<input name="empresa" type="text" value="<?php echo $empresa; ?>" class="txtBusq" id="empresa">
</label></center></td>
</tr>
<tr>
<td class="Tahoma11BoldTextoCaracteristicas">Persona de Contacto:</td>
<td><center><label>
<input name="persona" type="text" value="<?php echo $persona; ?>" class="txtBusq" id="persona">
</label>
</center></td>
</tr>
<tr>
<td class="Tahoma11BoldTextoCaracteristicas">Dirección:</td>
<td><center><label>
<input name="direccion" type="text" value="<?php echo $direccion; ?>" class="txtBusq" id="direccion">
</label>
</center></td>
</tr>
<tr>
<td class="Tahoma11BoldTextoCaracteristicas">País:</td>
<td><center><label>
<input name="pais" type="text" value="<?php echo $pais; ?>" id="pais" class="txtBusq">
</label>
</center></td>
</tr>
<tr>
<td class="Tahoma11BoldTextoCaracteristicas">Ciudad:</td>
<td><center><label></label>
<label></label>
<input name="ciudad" type="text" value="<?php echo $ciudad; ?>" id="ciudad" class="txtBusq">
</center></td>
</tr>
<tr>
<td height="23" class="Tahoma11BoldTextoCaracteristicas">Email: </td>
<td class="Tahoma11BoldTextoCaracteristicas"><label>
<center>
<input name="user_email" type="text" value="<?php echo $user_email; ?>" class="txtBusq" id="user_email">
</center>
</label></td>
</tr>
<tr>
<td class="Tahoma11BoldTextoCaracteristicas">Teléfono:</td>
<td class="Tahoma11BoldTextoCaracteristicas">
<center>
<input name="tel" type="text" value="<?php echo $tel; ?>" class="txtBusq" id="tel">
</center> </td>
</tr>
<tr>
<td height="53" class="Tahoma11BoldTextoCaracteristicas">Comentario:</td>
<td height="53" class="Tahoma11BoldTextoCaracteristicas"><div align="center"><span class="Tahoma11BoldTituloCreditos">Envíenos sus pedidos:</span><br>
<textarea name="pedido" value="<?php echo $pedido; ?>" cols="30" rows="7" class="txtBusq" id="pedido"></textarea>
</div></td>
</tr>
<tr>
<td height="53" colspan="2" class="Tahoma11BoldTextoCaracteristicas"><table width="251" border="0" align="center">
<tr>
<td width="66" height="45"><label>
<input type="reset" name="Submit" value="Cancelar">
</label></td>
<td width="109"> </td>
<td width="62"><label>
<input name="contacto" type="submit" id="contacto" value="Enviar">
</label></td>
</tr>
</table></td>
</tr>
</table>
</form>