Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

keep getting error emailing form

Status
Not open for further replies.

dunskii

Programmer
Sep 14, 2001
107
0
0
AU
Howdy,

It's been a few years since i last used php, anyways....

I have a one page site with a form that is emailed to my client...

When I submit the form I keep getting the error message that I put in the code...

And was wondering what the error could be... I dont think it is the code as I have pretty much copied it out of my book..could it be a server issue

Here's the code anyways and the site
Code:
<?php

if($BeenSubmitted)
	{
	if ($email)
		{
		if(mail($MailTo, $Query, "Name: $name Phone: $phone Product: $product Comment $comment", "From: $email"))
			{
			print("<B><center><font face=Arial, Helvetica, sans-serif color=#FF8A15>Thank you for your query, we will contact you shortly!</font></center></B>\n");
			} 
			else
			{
			print ("<b><center><font face=Arial, Helvetica, sans-serif color=#FF8A15>An Error Occured...Please try to resubmit the form!</font></b></center>\n");
			}
		}
		else
		{
		print ("<b><center><font face=Arial, Helvetica, sans-serif color=#FF8A15>Please enter an email address</font></b></center>\n");
		}
	}
?>

Thanks in advance

AD
 
copied it out of my book"

That, actually, gets more people in trouble with PHP than anything. A lot of books out there assume that the PHP runtime configuration setting "register_globals" is set to "on", which in earlier versions was the default. This meant that the value of the form field "<input type="text" name="foo">" would be found in the variable $foo. In installations of newer versions of PHP, however, the default setting for register_globals is off. This means that the above form field is only available in $_POST['foo'] or $_GET['foo'], respective of the "method" attribute of the form.

So have you verified the values in the variables you're passing to mail()?

It could also be a configuration problem. Can other scripts send email?

Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top