I am having trouble passing varibles from page to page in ver 4.2 I am using the exact same scripts as with previous versions, but keep getting the error:
Notice: Undefined variable:
Any thoughts?
4.2 passing varibles
Moderator: General Moderators
riley: Remember, in PHP 4.2, the php.ini setting register_globals is off by default.
I suggest changing the setting from off to on in your php.ini file.
However, I also recommend using $_POST and $_GET
So before, if you had a variable passed from a form called $username, you would use
$_GET['username'] for forms passed via get and $_POST['usrname'] for forms passed via post.
I suggest changing the setting from off to on in your php.ini file.
However, I also recommend using $_POST and $_GET
So before, if you had a variable passed from a form called $username, you would use
$_GET['username'] for forms passed via get and $_POST['usrname'] for forms passed via post.
- chiefmonkey
- Forum Commoner
- Posts: 25
- Joined: Sat Apr 20, 2002 5:21 am
- Location: Glasgow UK
As of PHP 4.1.2 $HTTP_***_VARS['var'] is not a global variable unless you declare it as one, whereas $_POST is global by defaultriley wrote:That worked! Thanks!
Can you explain why you would recommend using $_POST and $_GET. It works using just the varible name. Is there an advantage? Just for my education.
Thanks!
George
riley: Also, using $_GET and $_POST force you to write more secure code. Check out http://www.phpadvisory.com for more information on security.