SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: $_get???

Hybrid View

  1. #1
    SitePoint Evangelist cturner01's Avatar
    Join Date
    Jun 2006
    Location
    My computer
    Posts
    408
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question $_get???

    Can someone please explain to me how this works: <input type="hidden" name="article_id" value="<?php echo $_GET['article_id']; ?>">? Then placing this in a php file: $article_id = $_GET['article_id'];. Thanks in advance.

  2. #2
    SitePoint Addict evertcollab's Avatar
    Join Date
    Apr 2006
    Posts
    241
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The first line gets a variable from the url, say:

    yourpage.php?article_id=5 and puts it in this html hidden field

    the second gets the same variable and puts it in another variable ($article_id)

  3. #3
    SitePoint Enthusiast
    Join Date
    Jul 2006
    Location
    Brisbane, Australia
    Posts
    35
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    $_GET['article_id'] is a superglobal variable which basically fetches a section of the query string.
    Code:
    Example:
    http://www.domain.com/foobar.php?article_id=Hello
    Assuming the example above and that the page in question is http://www.domain.com/foobar.php, we could expect the following results:
    PHP Code:
    <input type="hidden" name="article_id" value="Hello"
    PHP Code:
    $article_id Hello 


Bookmarks

Posting Permissions

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