el HTML :
Código HTML :
<?php
$msg="";
      
if(isset($_REQUEST['enviar']) ){
   if($_POST['nombre']=="" || $_POST['email']==""){
       $msg="<script language=JavaScript>alert('Verifique Nombre y Correo'); </script>";
                                       
   } 
   if($msg==""){
      $headers  = 'MIME-Version: 1.0' . "\r\n";
      $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
      $headers .= 'To:' . "\r\n";
      $headers .= 'From: '.$_POST['nombre'].' <'.$_POST['email'].'>' . "\r\n";
      
      $mensaje ="<h3>Contacto</h3>";
      $mensaje.="<p><b>Nombre:</b> ".$_POST['nombre']."</p>";
      $mensaje.="<p><b>Empresa:</b> ".$_POST['empresa']."</p>";
      $mensaje.="<p><b>Telefono:</b> ".$_POST['telefono']."</p>";
      $mensaje.="<p><b>email:</b> ".$_POST['email']."</p>";
      $mensaje.="<p><b>Comentario:</b><br/>".htmlentities($_POST['comentario'])."</p>";
      
// aqui es donde hago el ALERT:
      if(mail("[email protected]","Contacto de la web LIMON INFORMATICA", $mensaje, $headers)){
         
      $msg = "<script language=JavaScript>alert('Gracias por contactarnos.');</script>";
                
      }else{
      
         $msg = "<script language=JavaScript>alert('XX.');</script>";
      }
   }
}
?>
y aqui esta mi formulario
Código HTML :
<form action="" method="post" name="">
<h5 id="">Formulario de Contacto</h5>
<div><p class="">* Nombre y Apellidos:</p></div>
<div>
      <input id="hold" name="nombre" type="text" value="<?php if(!empty($_POST['nombre'])){echo $_POST['nombre'];} ?>" size="50" maxlength="30" id="textInput" />
   </div><!--end of-->
   
        <div><p id="">Empresa:</p></div>
                                          
   <div>
   <input id="hold" name="empresa" type="text" value="<?php if(!empty($_POST['empresa'])){echo $_POST['empresa'];} ?>" size="50" maxlength="30" id="textInput" />
   </div><!--end of-->
   
       <div><p id="">* Correo electrónico</p></div>
                                          
   <div>
   <input id="hold" name="email" type="text" value="<?php if(!empty($_POST['email'])){echo $_POST['email'];} ?>" size="50" maxlength="30" id="textInput" />
   </div><!--end of-->
                                          
   <div><p id="">Teléfono</p></div>
                                          
   <div>
   <input id="hold" name="telefono" type="text" value="<?php if(!empty($_POST['telefono'])){echo $_POST['telefono'];} ?>" size="50" maxlength="30" id="textInput" />
   </div><!--end of-->
                                          
                                          
   <div><p id="">Comentarios</p></div>
      <div>
      <textarea id="hold" name="comentario" type="text" rows="4" cols="43" id="textArea" ></textarea>
      </div>
      <div class="button">
      <input name="enviar" type="submit" value="enviar" class="button" onclick="" />
      </div>
      <?php if($msg!=""){ ?>
      <div id=""><?php echo $msg; echo '<script language="JavaScript">  
document.location.href = "#contactando"; 
</script>';?></div>
      <?php } ?>
                                          
      </form>gracias de antemano y espero porder explicarme...
