extract data from URL

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • learnPHP
    New Member
    • Mar 2008
    • 20

    extract data from URL

    I have a page which needs to be loaded. The page has the following URL

    http://localhost/FAO_test/firms_WEB/subscribe.php?n ext=1&mode=add& email=&node=1

    or something like this.

    What i want is the value of "next" which is = 1 here.

    I actually want this value before the page is displayed that is as soon as a user is directed to this page i want to know the value of next so that depending on its value i can display the right contents.

    Can you please let me know how i can achieve this??
  • Markus
    Recognized Expert Expert
    • Jun 2007
    • 6092

    #2
    Originally posted by learnPHP
    I have a page which needs to be loaded. The page has the following URL

    http://localhost/FAO_test/firms_WEB/subscribe.php?n ext=1&mode=add& email=&node=1

    or something like this.

    What i want is the value of "next" which is = 1 here.

    I actually want this value before the page is displayed that is as soon as a user is directed to this page i want to know the value of next so that depending on its value i can display the right contents.

    Can you please let me know how i can achieve this??
    Have you heard of GETing the params?

    Pretty basic stuff.

    [php]
    $_next = @$_GET['next'];

    switch($_next)
    {
    case 1:
    code to be executed if $_next is == 1;
    break;

    case 2:
    code to be executed if $_next is == 2;
    break;

    // you get the idea
    }
    [/php]

    Comment

    • learnPHP
      New Member
      • Mar 2008
      • 20

      #3
      Originally posted by markusn00b
      Have you heard of GETing the params?

      Pretty basic stuff.

      [php]
      $_next = @$_GET['next'];

      switch($_next)
      {
      case 1:
      code to be executed if $_next is == 1;
      break;

      case 2:
      code to be executed if $_next is == 2;
      break;

      // you get the idea
      }
      [/php]

      Hi,

      Thanks for the help.

      Comment

      Working...