Jump to content

[SOLVED] Probably very simple - Forms!


herghost

Recommended Posts

I have this as my php code for sending a form:

 

<html>
<body>
<?php


$to = "*******@gmail.com";
$subject = "Contact Form";
$name = $HTTP_POST_VARS['name'];
$emailadd =$HTTP_POST_VARS['emailadd'];
$message = $HTTP_POST_VARS['message'];
$checkbox=$_POST['checkbox'];

if (!preg_match("/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/", $emailadd)) 
{
  echo "<h4>Invalid email address</h4>";
  echo "<a href='javascript:history.back(1);'>back</a>";
} 
elseif ($name == "") 
{
  	echo "<h4>Please enter your name</h4>";
  	echo "<a href='javascript:history.back(1);'>back</a>";
  	}
  		elseif ($message == "") 
	{
	echo "<h4>Please enter a message</h4>";
 	echo "<a href='javascript:history.back(1);'>back</a>";
  		}
  
  
		elseif (mail($to,$subject,$emailadd,$name,$message)) 
		{
  			echo "<h4>Thank you for sending us a message, we shall get back to you shortly<br><br>www.tiny-pixel.co.uk</h4>";
		} 
			else 
			{
  				echo "<h4>Can't send email to $email</h4>";
			}

//checkbox code

?>

</body>
</html>

 

However when I receive the email I only get the results of the $emailadd and $name result boxes not the $message?

 

Just cant work it out! If i swap the variables around I can get the message but not one of the others, so I assume it will send the email to the variable in the 1st field and 2 other variables, but not all 3!

 

What am i missing?

Link to comment
https://forums.phpfreaks.com/topic/117855-solved-probably-very-simple-forms/
Share on other sites

The definition of the mail() function -

 

Description

bool mail ( string $to, string $subject, string $message [, string $additional_headers [, string $additional_parameters]] )

The 3rd parameter becomes the message body of the email.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.