SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Evangelist
    Join Date
    Nov 2003
    Location
    Brisbane, Australia
    Posts
    408
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Passing an ID from page to page

    Hi All

    I need to pass an ID through my entire site.

    e.g. If some clicks a link and the ID is set to 3 I need that to pass 3 to every page of the site so it can pull in info for ID 3.

    Someone has to select ID 3 from a page first so the url would reads - www.domain.com/whatever.php?id=3

    I have a header include that I was planning to use for the get statement with is: $id = $_GET['id']; but it isn't working.

    Any ideas?

    Thanks for your help.

    M Barnes

  2. #2

    Join Date
    Oct 2003
    Location
    €uroLand
    Posts
    1,340
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sounds like a job for sessions.

  3. #3
    SitePoint Evangelist
    Join Date
    Nov 2003
    Location
    Brisbane, Australia
    Posts
    408
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Surely not.

    Isn't it an easy thing to pass an id from page to page without sessions?

    M Barnes

  4. #4
    Non-Member
    Join Date
    Nov 2003
    Location
    here
    Posts
    258
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sessions are easy enough as it is tbh..probably easier than doing it with out sessions.

  5. #5

    Join Date
    Oct 2003
    Location
    €uroLand
    Posts
    1,340
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by mrmbarnes
    Surely not.

    Isn't it an easy thing to pass an id from page to page without sessions?

    M Barnes
    Well, its up to you to reject my suggestion right from the start

    Certainly you can retrieve the value in question and add it to each url and form and if you find this easier then go on and do it this way. Its your decision.

  6. #6
    SitePoint Evangelist
    Join Date
    Nov 2003
    Location
    Brisbane, Australia
    Posts
    408
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi

    drzoid. I'm not rejecting your suggestion straight out, I was just thinking, hoping there was an easier way.

    I have not dealt with sessions before so if you can suggest a tutorial that might help it would be greatly appreciated.

    Many Thanks

    M Barnes

  7. #7

    Join Date
    Oct 2003
    Location
    €uroLand
    Posts
    1,340
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry for my harsh reply but your comment sounded rather snappish .... whatever, sessions arent difficult at all .... just ensure you call session_start() at the top of the page (before you do any output) and then you can save and later on retrieve whatever you wish in $_SESSION.

  8. #8
    SitePoint Wizard
    Join Date
    Oct 2001
    Location
    Tucson, Arizona
    Posts
    1,858
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by mrmbarnes
    I have not dealt with sessions before so if you can suggest a tutorial that might help it would be greatly appreciated.
    These docs should get you off to a good start.


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
  •