Dynadot Aftermarket: discover domain gems worth investing in. Visit our aftermarket.

PHP Mail form won't work - WHY?

SpaceshipSpaceship
SpaceshipSpaceship
Namecheap AuctionsNamecheap Auctions
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
Close
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
Close
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
Close
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
Close
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
Close
if(mail($to, $sunj, $msg))


you mispelled $subj

you spelled it as $sunj

that will probably change some things
 
0
Close
DomainEasy: flexible LTO options. Close more domain deals with financing.

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Filters for activity feeds
Your news feed, Latest activity, and the activity tab on profiles now have filter buttons: All, Posts, Quick replies, and Other. Your...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back