Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Newbie at PHP has simple problem
Old 09-04-2010, 03:12 PM Newbie at PHP has simple problem
maglite's Avatar
Novice Talker

Posts: 6
Name: Matt
Trades: 0
I think this is a simple problem. It is driving me nuts! I just need my form to send email to me:

<?
if(isset($_POST)) {
echo "Thank you, ".$_POST["name"].", we will contact you shortly;
mail("myemail@me.com", "Contact form filled out", $_POST["message"]);
}
?>

There is more code on the page also, HTML and stuff, but instead of showing, the whole page is BLANK. What the heck is going on?
maglite is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 09-04-2010, 03:22 PM Re: Newbie at PHP has simple problem
NullPointer's Avatar
Will Code for Food

Posts: 2,815
Name: Matt
Location: Irvine, CA
Trades: 0
There are three things I see wrong with your code. The first one is easy to spot when the syntax is highlighted:
PHP Code:
<?
if(isset($_POST)) {
echo 
"Thank you, ".$_POST["name"].", we will contact you shortly;
mail("
myemail@me.com", "Contact form filled out", $_POST["message"]);
}
?>
You're missing your closing quote on the 3rd line. The second one is that you're using a short tag. Don't use <? use <?php. The third is that you're not including headers in your email. Take a closer look at the documentation: http://us2.php.net/manual/en/function.mail.php

Quote:
When sending mail, the mail must contain a From header
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
NullPointer is offline
Reply With Quote
View Public Profile Visit NullPointer's homepage!
 
Old 09-04-2010, 03:26 PM Re: Newbie at PHP has simple problem
maglite's Avatar
Novice Talker

Posts: 6
Name: Matt
Trades: 0
Oh, oops! I wish my editor highlighted the code like that. Someone on another forum told me to just use notepad, so I learn how the code works, so that's what I've been using.

I will read the documentation, thanks
maglite is offline
Reply With Quote
View Public Profile
 
Old 09-04-2010, 07:46 PM Re: Newbie at PHP has simple problem
NullPointer's Avatar
Will Code for Food

Posts: 2,815
Name: Matt
Location: Irvine, CA
Trades: 0
Try notepad++
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
NullPointer is offline
Reply With Quote
View Public Profile Visit NullPointer's homepage!
 
Reply     « Reply to Newbie at PHP has simple problem
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.57984 seconds with 12 queries