Ver Mensaje Individual
  #1 (permalink)  
Antiguo 28/06/2009, 09:28
xhisna
 
Fecha de Ingreso: diciembre-2007
Mensajes: 179
Antigüedad: 16 años, 4 meses
Puntos: 0
problemas con phpmailer

Hola a todos estoy intentando crear un formulario con el que se pueda adjuntar un archivo y que ese formulario llegue a un email. Este es el codigo

Código:
  <div id="foto">
					<fieldset>
						<p>Trabaja con Nosotros</p>
						<form method="post" onsubmit="return validacontacto()" action="" target='_self' enctype="multipart/form-data">
					
						<center>
				   <label for="nombre" id="nombre_t"style="color:black;margin-right:2%;">Nombre</label>
				   <input name="nombre" type="text" id="nombre" class="formuentrada" maxlength="20" size="30" />
				   <br/>
				   <label for="nombre"id="nombre_e" style="color:red;display:none;width:100%;">Debes introducir tu nombre</label>
				   <br/>
                   <label for="email" id="email_t" style = "color:black;margin-right:4%;">E-mail</label>
				   <input name="email" type="text" id="email" class="formuentrada" maxlength="40" size="30"/>
                   <br/>
                   <label for="email" id ="email_e"style="color: red;display:none;width:100%;">Debes introducir el E-mail</label>
				   <label for="email" id="email_e1"style="color:red;display:none;width:100%;">El formato del e-mail no es correcto</label>
				   <br/>
				   <label for="telefono" id="telefono_t" style="color:black;margin-right:1%;">Tel&eacute;fono</label>
				   <input name="telefono" type="text"  id="telefono" class="formuentrada" maxlength="9" size="30"  />
				   <br/>
				   <label for= "telefono" id= "telefono_n1" style="color:red;display:none;width:100%;">Debes introducir un tel&eacute;fono de contacto</label>
				   <label for= "telefono" id ="telefono_n2" style="color:red;display:none;width:100%;">El formato del tel&eacute;fono no es correcto</label>
				   <br/>
				   <label id="pudeseado" name="pudeseado" style="color:black; margin-right:13%">Puesto deseado</label>
				   <select id="puesto" name="puesto" class="TitleColor required validate-selection">
									<option value="0">   Selecciona ...   </option>
									<option value="2">Cocina</option>
									<option value="1">Camarer@</option>
						</select><br/>
						<label for= "puesto" id ="puesto_n1" style="color:red;display:none;width:100%;">Debe seleccionar su puesto deseado</label>
					<br/>
					<br/>
				   <label for ="carta" id="carta" style="color:black;margin-right:28%">Carta de Presentaci&oacute;n</label><br/><br/>
				   <textarea rows="4" cols="32" id="carta" name="carta" class="formuentrada" style="margin-left:2%"></textarea>
				   <br/>
				   <br/>
				   <p><label for="curri" id="curri" style="color:black;margin-right:15%">Adjuntar curriculum </label>
				   
          				<INPUT id="archivo" type=file name="archivo"></p>
					
          				<INPUT type=submit value="Enviar">
					</form>
				</center>
				
				
<?					
				requiere("class.phpmailer.php");
				
			if ($_POST['action'] == "send") {
   
          $varname = $_FILES['archivo']['name'];
   
          $vartemp = $_FILES['archivo']['tmp_name'];
   
         
   
          $mail = new PHPMailer();
   
          $mail->Host = "localhost";
   
          $mail->From = "Sabor a mar";
   
          $mail->FromName = $_POST['nombre'];
		  
		  $mail->Contacto = $_POST['telefono'];
  
          $mail->Email = $_POST['email'];
		  
		  
		  

  
          $mail->AddAddress(mail('[email protected]'));
  
          if ($varname != "") {
  
              $mail->AddAttachment($vartemp, $varname);
  
          }
  
          $body = "<strong>Mensaje</strong><br><br>";
  
          $body.= $_POST['puesto']."<br>";
		  $body.= $_POST['carta']."<br>";
  
          $body.= "<i>Enviado por http://saboramar.com</i>";
  
          $mail->Body = $body;
  
          $mail->IsHTML(true);
  
          $mail->Send();
?>
				<fieldset>
				<p><strong>Datos Recibidos.</strong><br />
				Sus datos personales se han enviado correctamente, ahora forma parte de nuestra bolsa de trabajo.<br/>
				Cuando surja una vacante nos pondremos en contacto con usted. Muchas Gracias</p>
				<center><input type="button" value="Volver" onClick="location.href='trabaja.php'" /></center>
				</fieldset>
				<? }
				else {
					
			?><fieldset>
				<strong>Datos Erroneos.</strong><br />
				Ha ocurridos un error al enviar sus datos por favor intentelo de nuevo o mas tarde<br/></p>
				<center><input type="button" value="Volver" onClick="location.href='trabaja.php'" /></center>
				</fieldset><?

					
				}
					 
    
				
			
?>


						
						</fieldset>
						</div>
No me da ningun problema pero me vuelve a salir la pagina del formulario sin decir si se han enviado los datos o no. No se que es lo que hago mal pues no estoy mu puesta en php. Gracias