View Full Version : difference between _POST[somevariable] and somevariable

04-20-2004, 06:14 AM
if i have one page with <form action='nextpage.php' method=post> and it has a text field named somevariable, in the nextpage.php i wana use this variable, what is the difference between calling this variable somevariable and _POST[somevariable]?

04-20-2004, 09:14 AM
somevariable will work only with register_globals on, $_POST[variablename] will work with register_globals on or off. Since php4.2, by default, register_globals have been turned off by default. Not only is it easier to understand the code using the super globals, but it's also more secure as $_POST[variable] will only work if the form has been POSTed and can't be altered by GET or a session or whatever. (unless you've coded it to change)