NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page PHP Mail form won't work - WHY?

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 07-13-2004, 09:44 AM THREAD STARTER               #1 (permalink)
Senior Member
Join Date: Jun 2004
Location: United Kingdom
Posts: 2,694
will7 has much to be proud ofwill7 has much to be proud ofwill7 has much to be proud ofwill7 has much to be proud ofwill7 has much to be proud ofwill7 has much to be proud ofwill7 has much to be proud ofwill7 has much to be proud of
 



PHP Mail form won't work - WHY?


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 Code:
<?php
$to
="willnarburgh@msn.com";
$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:
????: NamePros.com http://www.namepros.com/programming/38609-php-mail-form-wont-work-why.html

Quote:
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.
will7 is online now  
Old 07-14-2004, 10:14 AM   #2 (permalink)
NamePros Regular
 
nick's Avatar
Join Date: Jun 2004
Location: Iowa City
Posts: 705
nick has much to be proud ofnick has much to be proud ofnick has much to be proud ofnick has much to be proud ofnick has much to be proud ofnick has much to be proud ofnick has much to be proud ofnick has much to be proud of
 


Save The Children
PHP Code:
$msg="Name: ".$_POST['fname']." \r \n E-Mail Address: ".$_POST['email']." \r \n 
Query Type:  "
.$_POST['qtype']." \r \n Message: ".$_POST['msg']." \r \n; 

????: NamePros.com http://www.namepros.com/showthread.php?t=38609
you forgot a " at the end of that line before the ;

." \r \n";
nick is offline  
Old 07-14-2004, 12:59 PM THREAD STARTER               #3 (permalink)
Senior Member
Join Date: Jun 2004
Location: United Kingdom
Posts: 2,694
will7 has much to be proud ofwill7 has much to be proud ofwill7 has much to be proud ofwill7 has much to be proud ofwill7 has much to be proud ofwill7 has much to be proud ofwill7 has much to be proud ofwill7 has much to be proud of
 



Woah! If I do that, I get a crazy error:

Quote:
Notice: Undefined index: fname in C:\Abyss Web Server\htdocs\fusioncre8\contmail.php on line 4
????: NamePros.com http://www.namepros.com/showthread.php?t=38609

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
will7 is online now  
Old 07-14-2004, 03:51 PM   #4 (permalink)
NamePros Regular
 
QBert's Avatar
Join Date: Apr 2004
Location: Australia
Posts: 814
QBert is just really niceQBert is just really niceQBert is just really niceQBert is just really nice
 


Save a Life Alzheimer's Breast Cancer
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
__________________
:: www.URLBlur.com - Blur your URL and protect your privacy!
:: www.AokHost.com - Powerful, Secure and Reliable Website Hosting!
QBert is offline  
Old 07-14-2004, 11:55 PM THREAD STARTER               #5 (permalink)
Senior Member
Join Date: Jun 2004
Location: United Kingdom
Posts: 2,694
will7 has much to be proud ofwill7 has much to be proud ofwill7 has much to be proud ofwill7 has much to be proud ofwill7 has much to be proud ofwill7 has much to be proud ofwill7 has much to be proud ofwill7 has much to be proud of
 



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...
__________________
Will Narburgh | Graphic design | Twitter | Email me
will7 is online now  
Old 07-15-2004, 01:13 AM   #6 (permalink)
New Member
Join Date: Jul 2004
Posts: 2
Immortal is an unknown quantity at this point
 



Quote:
if(mail($to, $sunj, $msg))

you mispelled $subj

you spelled it as $sunj

that will probably change some things
__________________
-Immortal-
Immortal is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Liquid Web Smart Servers  
All times are GMT -7. The time now is 06:03 AM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger