Ver Mensaje Individual
  #1 (permalink)  
Antiguo 22/08/2011, 05:38
bestebat2
 
Fecha de Ingreso: mayo-2011
Mensajes: 8
Antigüedad: 12 años, 11 meses
Puntos: 0
Problema al enviar con php

Hola a todos,

estoy haciendo una pequeña web en la que en el contacto he puesto varios campos y un botón de enviar. Si le doy a enviar el mensaje se envía pero me salta a una pantalla en blanco.
Qué debo incluir en los ficheros que adjunto para que no salte a esa página y se quede en la página de contacto con los formularios vacíos?.

Mi segundo problema es que al recibir el mail el mensaje que recibo tiene los campos vacíos y no sé qué debo añadir en los archivos para que al rellenar los campos se reciba el mail con el contenido escrito.

Os adjunto los 2 archivos.

Muchas gracias por la ayuda.

Os agradecería que me dierais la información clara pues no soy programador.

Gracias

ARCHIVO PHP
Código:
<?php 

$nombre = $_POST['nombre'];
$mail = $_POST['mail'];
$empresa = $_POST['empresa'];

$para = '[email protected]';
$titulo = 'Contacto web';
$mensaje = "Este mensaje fue enviado por " . $nombre . ", de la empresa " . $empresa . " \r\n";
$mensaje .= "Su e-mail es: " . $mail . " \r\n";
$mensaje .= "Mensaje: " . $_POST['mensaje'] . " \r\n";
$mensaje .= "Enviado el " . date('d/m/Y', time());

$cabeceras = 'From: '.$mail . "\r\n" .
    'Reply-To: [email protected]' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

mail($para, $titulo, $mensaje, $cabeceras);

?>
ARCHIVO CONTACTO HTML
Código:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">

<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body>
<table style="width:100%">
	<tr>
		<td style="width:100%" height="209">
			<table style="width:100%">
				<tr>
					<td style="width:50%; background:url(images/bg1.gif) repeat-x top right" height="209"></td>
					<td style="width:750" height="209">
						<table width="750">
							<tr>
								<td width="750" height="209">&nbsp;</td>
							</tr>
						</table>
					</td>
					<td style="width:50%; background:url(images/bg1.gif) repeat-x top left" height="209"></td>
				</tr>
			</table>
		</td>
	</tr>
	<tr>
		<td style="width:100%; background-color:#F4F2E5" height="544"><table width="790" align="center">
		  <tr>
		    <td width="782" height="474"><table>
		      <tr>
		        <td width="107" height="474"></td>
		        <td width="368" height="474"><table>
		          <tr>
		            <td width="419" height="343"><div style="margin:41 0 0 4px "> <img alt="" src="images/7_w1.gif" border="0"><br>
		              <br style="line-height:5px">
		              <img alt="" src="images/7_line.gif" border="0"><br>
		              <br style="line-height:23px">
		              <img src="images/7_p1.jpg" align="left" style="margin-right:18px; margin-top:4px; margin-left:-4px " alt="" border="0"><strong>HERGIL COURIER,</strong> se encuentra situado en la siguiente dirección:<br>
		              <br style="line-height:15px">
		              Galerías Bellas Artes, Calle ??????? ........ ?????????.
		              .<br>
		              <br style="line-height:3px">
		              <strong>E-mail</strong>:<br style="line-height:40px">
		              <img alt="" src="images/7_w2.gif" border="0"><br>
		              <br style="line-height:5px">
		              <img alt="" src="images/7_line.gif" border="0"><br>
		              Puede contactar con nosotros a través de este formulario. En él podrá consultarnos lo que desee, consultas, dudas, sugerencias, peticiones de presupuesto, etc...</div></td>
		            </tr>
		          <tr>
		            <td width="419" height="131"><form enctype="multipart/form-data" name="" id="form" action="enviar.php">
		              <table>
		                <tr>
		                  <td width="4" height="131"></td>
		                  <td width="184" height="131"><table>
		                    <tr>
		                      <td width="184" height="30"><input type="text" value="Su nombre:">
		                        <br></td>
		                      </tr>
		                    <tr>
		                      <td width="184" height="30"><input type="text" value="Teléfono:">
		                        <br></td>
		                      </tr>
		                    <tr>
		                      <td width="184" height="71"><input type="text" value="E-mail:">
		                        <br></td>  
		                      </tr>
		                    </table></td>
		                  <td width="176" height="131"><textarea name="textarea"  cols="35" rows="35">Su mensaje:</textarea>
		                    <br>
		                    <br style="line-height:5px ">
		                    <img alt="" src="images/spacer.gif" width="38" height="1"><a href="#" class="more" onClick="document.getElementById('form').reset()">borrar</a><a href="#"  class="more" onClick="document.getElementById('form').submit()">enviar</a></td>
		                  </tr>
		                </table>
		              </form></td>
		            </tr>
		          </table></td>
		        <td width="66" height="474"></td>
		        <td width="171" height="474"><br style="line-height:41px">
		          <img alt="" src="images/7_w2.gif" border="0"><br>
		          <br style="line-height:8px">
		          <br>
		          <br style="line-height:21px">
		          <br>
		          <br style="line-height:19px">
		          <br>
		          <br style="line-height:23px">
		          <br></td>
		        <td width="6" height="474"></td>
	          </tr>
		      </table></td>
	      </tr>
</table></td>
</tr>
			</table>				
		</td>
	</tr>
	<tr>
		<td style="width:100%; background-image:url(images/bottom.gif)" height="83">			
			<table width="750" align="center">
				<tr>
					<td width="58" height="83"></td>
				  <td width="507" height="83" class="footer">
					  <p><br style="line-height:32px">
                  <a href="index.html">&nbsp;Home</a> &nbsp; &nbsp; : &nbsp; &nbsp;<a href="index-2.html">Empresa</a> &nbsp; &nbsp; : &nbsp; &nbsp; <a href="index-3.html">Servicios</a> &nbsp; &nbsp; : &nbsp; &nbsp; Contacto</p></td>
					<td width="122" height="83" class="footer">
						<br style="line-height:32px">
						<span>Phone: &nbsp;+34 <br>
						FAX: &nbsp; &nbsp; &nbsp;+34 ?????????</span>
					</td>
					<td width="63" height="83">
						<br style="line-height:29px">
						<img src="images/z.gif" alt="" border="0"><br>
					</td>
				</tr>
			</table>					
		</td>
	</tr>
</table>
</body>
</html>