php, form mail problem..
I've 2 pages challenge.html and send.php. When I attempt to use my form to take and process info that will be sent via e-mail I get the following error.
(this is only half of the errors.. but the rest is the same stuff)
Notice: Undefined variable: sender_name in C:\Inetpub\finalphase\neverplaysober\v4\send.php on line 3
Notice: Undefined variable: sender_clanname in C:\Inetpub\finalphase\neverplaysober\v4\send.php on line 4
Notice: Undefined variable: sender_email in C:\Inetpub\finalphase\neverplaysober\v4\send.php on line 5
Notice: Undefined variable: sender_aim in C:\Inetpub\finalphase\neverplaysober\v4\send.php on line 6
Notice: Undefined variable: sender_date in C:\Inetpub\finalphase\neverplaysober\v4\send.php on line 7
Challenge.html (code)
-----------------------------------------------------------
Your Name:
Your Clans Name:
Your E-Mail Address:
Your AOL IM name:
What Day would you like the match to be?
What time would you like the match to be?
Game to be played:
JK2
HL-cs
HL-DoD
HL-tfc
RTCW
Battle Net
Sven-Coop
Number of Players?
Map 1
Map 2
-----------------------------------------------------------
send.php (code)
-----------------------------------------------------------
<?php
$msg = "Sender Name:\t$sender_name\n";
$msg .= "Your Clans Name:\t$sender_clanname\n";
$msg .= "Sender E-Mail:\t$sender_email\n";
$msg .= "Your AOL IM name:\t$sender_aim\n";
$msg .= "What Day would you like the match to be?\t$sender_date\n";
$msg .= "What time would you like the match to be?\t$sender_time\n";
$msg .= "Game to be played:\t$sender_game\n";
$msg .= "Map 1\t$sender_map1\n";
$msg .= "Map 2\t$sender_map2\n";
$recipient = "[email protected]";
$subject = "Challenge NPS";
$mailheaders = "From: Never Play Sober Challenge Form <> \n";
$mailheaders .= "Reply-To: $sender_email\n\n";
mail($recipient, $subject, $msg, $mailheaders);
echo "<HTML><HEAD><TITLE>Form Sent!</TITLE></HEAD><BODY>";
echo "<H1 align=center>Thank You, $sender_name</H1>";
echo "<P align=center>Your feedback has been sent.</P>";
echo "</BODY></HTML>";
?>
------------------------------------------------------------
Link to form: http://www.neverplaysober.com/v4/challenge.html
O, I get the e-mail just not any of the info I've typed into the fields.
ex.
Sender Name:
Your Clans Name:
Sender E-Mail:
Your AOL IM name:
What Day would you like the match to be?
What time would you like the match to be?
Game to be played:
Map 1
Map 2
Suzanne posted this at 06:11 — 18th May 2002.
She has: 5,507 posts
Joined: Feb 2000
Moving this to scripting. Hope someone there can help you!
Abhishek Reddy posted this at 08:45 — 18th May 2002.
He has: 3,348 posts
Joined: Jul 2001
If I remember right, use the GET method for your form, or set the variables again in send.php using $HTTP_POST_VARS (I think).
I wonder if it matters, but what version of PHP are you running?
Abhishek Reddy posted this at 13:23 — 18th May 2002.
He has: 3,348 posts
Joined: Jul 2001
Useful link: http://www.php.net/manual/en/language.variables.external.php
arin posted this at 04:14 — 21st May 2002.
They have: 8 posts
Joined: May 2002
Versions of PHP before 4.2 allowed to you access form variables as if they were global variables. To use them, you need to define each variable as a global variable:
global $var1, $var2, $var3; // ...
'This will need to go at the top of your send.php file, and it will also be needed inside any functions you define there.
In version 4.2 and later, the direct access of all system and environment variables has been disabled. You will need to refer to http://www.php.net/manual/en/language.variables.predefined.php#language.variables.superglobals for more details on how to access them (I'm not using PHP4.2 yet, but this change will stay for future versions, so it's a good idea to get into the habit now!)
Good luck!
arin
Web hosting from just $2 a month! http://www.xeosdd.net
Mark Hensler posted this at 07:06 — 21st May 2002.
He has: 4,048 posts
Joined: Aug 2000
That is only because PHP 4.2 set the default for register_globals to false, when it's always been true in previous versions. Easy fix....
Method 1: Alter your php.ini and set it to true
Method 2: Add this line to your .htaccess file:
php_flag register_globals on
If you want to use method 2...
Mark Hensler
If there is no answer on Google, then there is no question.
arin posted this at 08:04 — 21st May 2002.
They have: 8 posts
Joined: May 2002
So what does somebody do if they can't access their php.ini file? The PHP team disabled it for a reason, so it makes sense to start using the new method, as the old way may become depreciated over time and not be usable at all...
arin
Web hosting from just $2 a month! http://www.xeosdd.net
Mark Hensler posted this at 16:21 — 21st May 2002.
He has: 4,048 posts
Joined: Aug 2000
If you don't have access to your php.ini file, you use method 2.
It is now disabled for security reasons. Which is a good thing. But it also blows up a lot of scripts. So if your running sites that are dependant on these old scripts and need a quick fix...
Mark Hensler
If there is no answer on Google, then there is no question.
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.