Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Nov 2002
    Posts
    180
    Thanks
    0
    Thanked 0 Times in 0 Posts

    difference between _POST[somevariable] and somevariable

    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]?

  • #2
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,266
    Thanks
    6
    Thanked 48 Times in 48 Posts
    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)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •