PHP guru's
- Started
- Last post
- 13 Responses
- smoothblend
I need some simple PHP help. I have a contact form and i want to store the e-mails in a txt file. Also my server dosent use register globals. i have to use a format like this (" $_POST["email"] ")
so im stuck..any help would be killer!
thanks in advance..
C
- mike0
this should show you everything you need to get this working "C"
http://www.php.net/manual/en/fun…
also, whether register globals id on or not you always want to reference your vars in their namespace... otherwise you are leaving things pretty open for easy exploitation.
- enobrev0
and beyond exploitation, it's very possible that future versions of php will disable register globals entirely. All new versions default to having it off, so getting the habit of using variable scope ($_POST, $_GET, $_COOKIE, $_SESSION, etc) is a good thing to do right away.
- mike0
yeah enobrev!
love ya man.
- unfittoprint0
a loop like this might help...
foreach ($HTTP_GET_VARS as $key=>$value) {
print "$key == $value";
}
- smoothblend0
thanks you guys.. HUGE HELP!!!
Mike thanks for the info.. ill start coding the "right" way now.. heh
Thanks again..
- mike0
ah c'mon...
I wasn't trying to give you a hard time... just trying to pass on some things often learned the hard way.
best of luck.
- enobrev0
more fun with vars... try
echo var_export($_REQUEST);
which will show a list of all post and get vars (and cookies too, i think).
- enobrev0
good to see ya mike!
- smoothblend0
Actualy Mike I was saying thanks..just came out sarcastic
:)
- smoothblend0
this is what i have so far..
and this was taken from a script I wrote for a bookstore..
any takers..heh
- smoothblend0
now we can see it :)
$file = "emails.txt"
//open our file
$fp = fopen("$file" , "a+");//add details from form
fputs($fp ,"$email, ");//close file
fclose($fp);
- mike0
check your email curtis.
- smoothblend0
thanks mike.. life saver!