uff una vez cambiado me sigue saliendo un error:
PHP Notice: Undefined index: accion in C:\Inetpub\wwwroot\contactar\index.php on line 25
la linea 25: if ($_POST["accion"] == "") {
weno creo esa variable sólo para que el usuario que entre se le vaya al formulario y una vez ponga en enviar vaya a la accion send y asi enviarme el email no me vienen de ningun formualrio solo es para ahorrar otro archivo para hacer el revisar. te dejo lo que he cambiado:
<?php
/*
$HTTP_GET_VARS[accion]
// POR ESTO:
$HTTP_POST_VARS[accion]
// O ESTO, EN ESTE CASO DA IGUAL
$_POST[accion]*/
?>
<?php
if ($_POST["accion"] == "") {
?>
<table width="770" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="159"><table width="159" border="0" cellpadding="0" cellspacing="0">
<tr>
<td> </td>
</tr>
</table></td>
<td width="595">
<table width="75%" border="1" cellpadding="0" cellspacing="0" bordercolor="#2D2D2D">
<tr>
<td><form action="index.php?accion=enviar" method="post" name="contacto">
<table width="75%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td class="table2">Tu nombre: </td>
<td><input name="name" type="text" id="name" class="table" /></td>
</tr>
<tr>
<td class="table2">Tu email:</td>
<td><input name="email" type="text" id="email" class="table" /></td>
</tr>
<tr>
<td class="table2">Tu asunto: </td>
<td><label>
<select name="asunto" class="table" id="asunto">
<option>- Seleccionar Opcio -</option>
<option>Sugerencia</option>
<option selected="selected">Colaborar</option>
</select>
</label></td>
</tr>
<tr>
<td class="table2">Tu comentario: </td>
<td><textarea name="com" rows="5" class="table" id="com"></textarea></td>
</tr>
</table>
<p align="center">
<input type="submit" name="Submit" value="enviar" />
</p>
</form></td>
</tr>
</table>
</td>
</tr>
</table>
<p> </p>
<?php
}else{
if ($_POST["accion"] == "enviar"){
$email = $HTTP_POST_VARS["email"];
$nombre = $HTTP_POST_VARS["nombre"];
$com = $HTTP_POST_VARS["com"];
if($email == "" || $com== ""){
echo'Rellena los campos vacios.<a href=javascript:history.go(-1)>Atrás</a>';
}else{
$to = "zak@hotmail.com";
$subject = "Contactar";
$msg="Hola tienes un formulario enviado:\nSu nombre: " .$name. " \n Su e-mail: " .$email ." \n Su descripción: ". $com . ".";
mail($to, $subject, $msg);
echo'mensaje enviado correctamente';
}
}
}
?>