Web Design Forum  
 
Go Back   Web Design Forum > Web Software > Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 01-30-2006, 02:53 AM   #1 (permalink)
New Member
 
Join Date: Jan 2006
Posts: 1
Question My first PHP script - what's wrong with it?

I just made my first PHP script, but there must be a mistake in it.
Could any of you please take a look at it and tell me what is wrong?
When the script executes it is supposed to send me an email with the information somebody filled out in a form on my website (first name, last name, zip code and email).
The thank you and error pages do show up when somebody tries to fill out the form, but I never get an email.
Any ideas for this newbie?
PHP Code:
<?

$mailto 
"filled in my email address here" ;


$subject "newsletter sign up" ;



$formurl "http://my URL/newsletter.html" ;
$errorurl "http://my URL/newslettererror.html" ;
$thankyouurl "http://my URL/thankyounewsletter.html" ;


$first_name $_POST['first_name'] ;
$last_name $_POST['last_name'] ;
$zip_code $_POST['zip_code'] ;
$email $_POST['email'] ;
$http_referrer getenv"HTTP_REFERER" );

if (!isset(
$_POST['email'])) {
    
header"Location: $formurl" );
    exit ;
}
if (empty(
$first_name) || empty($last_name) || empty($zip_code) || empty($email)) {
   
header"Location: $errorurl" );
   exit ;
}
$first_name strtok$first_name"\r\n" );
$last_name strtok$last_name"\r\n" );
$zip_code strtok$zip_code"\r\n" );
$email strtok$email"\r\n" );



mail($mailto$subject);
header"Location: $thankyouurl" );
exit ;

?>
Hudba is offline   Reply With Quote
Old 02-15-2006, 08:36 AM   #2 (permalink)
New Member
 
Join Date: Dec 2004
Posts: 13
Default

The mail() function only works on a UNIX-based server. If you're using a Windiws machine then it won't work. Generally it's not a problem because generally the web server you actually use is UNIX based
drummondjacob is offline   Reply With Quote
Old 03-27-2006, 11:26 AM   #3 (permalink)
New Member
 
Join Date: Mar 2006
Posts: 7
Default

HI, you just forgot to put one of the three "must have" parameter inorder to send the mail.

Your code should be like this
mail($mailto, $subject,$message);

Where $message is the content of the email.
__________________
Thunder Burung Web Design : Pay Online and Get Your Dream WebSite!
thunderburung is offline   Reply With Quote
Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 11:02 AM.


Computer Forum - Internet Business - Webpage Design

 
Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.2.0 ©2008, Crawlability, Inc.