4 replies
I did 18 month's of php to get a telescope on the net back in 2005.

That was a long time ago.

Now I'm scraping off the rust from those dormant neurons & on the coding path again for a bit - so please don't bite my head off

(The title is meant to be a pun by the way)

On with the show:




Can I use _$REQUEST to parse the 098.... into a variable like this:

$mystring = ($_REQUEST);

I just want to capture all the stuff after the ? into a variable and then do some funky stuff with the variable afterwards

#_$request #$request #php #rusty
  • Profile picture of the author eminc

    First off, the type of request which you have indicated is a GET request.

    Secondly, you will require to add a variable to the value, otherwise it won't recognize the value. Every value you pass must have a variable name



    This way you can access the variable myvar in your PHP code somewhat like this

    $myVariable = $_REQUEST['myvar']; or $myVariable = $_GET['myvar']

    Here's a tutorial for feedback form script. I guess it'll help more.

    PHP Tutorial: Writing Your First PHP Script: A Feedback Form (a FormMail Script) (thesitewizard.com)


    The best way to predict future is to create it ― Abraham Lincoln

    {{ DiscussionBoard.errors[4960242].message }}
    • Profile picture of the author dezfutak
      Many thanks Mohit
      {{ DiscussionBoard.errors[4960269].message }}
      • Profile picture of the author Tim Brownlaw
        Another nice thing to put back into your Neurons is the print_r() function...

        So when you are playing with arrays etc such as $_REQUEST which is a catch all for , $_GET, $_POST and stuff back from Databases... it's a handy little debug command to have...

        So in your case - say using print_r($_GET) will show you what it's is seeing.

        Good to see you are getting back into PHP


        Great Success is built from many little successes!

        http://www.timbrownlaw.com - My Wee Part of the World.


        {{ DiscussionBoard.errors[4960841].message }}
  • Profile picture of the author mgkimsal
    There's a couple other ways to get at that information if you want/need to keep 'clean' URLs.


    will show you likely $_SERVER['QUERY_STRING'] has the value you're looking for.

    foo.php/foobarbaz would give you a $_SERVER['PATH_INFO'] (or $_SERVER['REQUEST_URI'] in some cases) with 'foobarbaz' (maybe '/foobarbaz') - but you can play around with that

    $_SERVER['QUERY_STRING'] should get you the raw data if you don't want to (or can't!) modify code to have a "?var=" named prefix.

    Michael Kimsal
    http://heywords.com/ - for article writers

    {{ DiscussionBoard.errors[4975360].message }}

Trending Topics