PHP Mail form won't work - WHY?

SpaceshipSpaceship
Watch

will7

VIP Member
Impact
29
I am stuck. This mail form I made in PHP doesn't work when as far as I can see, it should. The code is:

PHP:
<?php
$to="[email protected]";
$subj="FusionCre8 Contact Form";
$msg="Name: ".$_POST['fname']." \r \n E-Mail Address: ".$_POST['email']." \r \n Query Type: 

".$_POST['qtype']." \r \n Message: ".$_POST['msg']." \r \n;

if(mail($to, $sunj, $msg))
{
	header( "thanks.htm" );
} else {
	header( "notsent.htm" );
}
?>

And this is the error I get:

Parse error: parse error, unexpected T_STRING in C:\Abyss Web Server\htdocs\fusioncre8\contmail.php on line 8

Also, any other problems you can see would be helpful. Thanks people, will7.
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
PHP:
$msg="Name: ".$_POST['fname']." \r \n E-Mail Address: ".$_POST['email']." \r \n 
Query Type:  ".$_POST['qtype']." \r \n Message: ".$_POST['msg']." \r \n;


you forgot a " at the end of that line before the ;

." \r \n";
 
0
•••
Woah! If I do that, I get a crazy error:

Notice: Undefined index: fname in C:\Abyss Web Server\htdocs\fusioncre8\contmail.php on line 4

Notice: Undefined index: email in C:\Abyss Web Server\htdocs\fusioncre8\contmail.php on line 4

Notice: Undefined index: qtype in C:\Abyss Web Server\htdocs\fusioncre8\contmail.php on line 4

Notice: Undefined index: msg in C:\Abyss Web Server\htdocs\fusioncre8\contmail.php on line 4

Notice: Undefined variable: sunj in C:\Abyss Web Server\htdocs\fusioncre8\contmail.php on line 6

Warning: mail(): Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\Abyss Web Server\htdocs\fusioncre8\contmail.php on line 6

Warning: Cannot modify header information - headers already sent by (output started at C:\Abyss Web Server\htdocs\fusioncre8\contmail.php:4) in C:\Abyss Web Server\htdocs\fusioncre8\contmail.php on line 10

That's what I get now :| :|
 
0
•••
very intresting, any chance you can post a working copy of that when you get it to work? ive allwase just used matts script.

berty
 
0
•••
Yes I will post a working copy of it. I think it's coz it's on a web server on my comp so when I actually put it on da intanet it should work. We shall see when I get my hosting...
 
0
•••
if(mail($to, $sunj, $msg))


you mispelled $subj

you spelled it as $sunj

that will probably change some things
 
0
•••
Appraise.net

We're social

Escrow.com
Spaceship
Rexus Domain
CryptoExchange.com
Domain Recover
CatchDoms
DomainEasy — Live Options
DomDB
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back