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
    Dec 2005
    Posts
    217
    Thanks
    1
    Thanked 0 Times in 0 Posts

    which one to use and why ?

    Hello forums !!
    I had some few questions.
    Suppose for passing the query string through url and retrieving it , i had seen the 2 ways.
    one way:
    PHP Code:
    $_GET['parm'
    another way:
    PHP Code:
    $reqVar '_' $_SERVER['REQUEST_METHOD'];
    $form_vars = $$reqVar;
    $parm $form_vars['parm'] ; 
    Can anybody make me clear of using second way, actually i didnt get that .
    Thanks in advance to all of you.

  • #2
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,604
    Thanks
    0
    Thanked 645 Times in 635 Posts
    The second method loads a new array with all of the entries passed to the page in GET, POST and COOKIE fields providing more ways for people to break into your site and change things you don't want changed. You should avoid using $_REQUEST (which is what the first two statements of the second method uses and use specifically $_GET $_POST or $_COOKIE depending on which of the three you expect to contain the value rather than allowing it to be picked up from any of the three (with the potential for it to be overridden in one of the others).
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.


  •  

    Posting Permissions

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