SitePoint Sponsor

User Tag List

Results 1 to 9 of 9

Thread: php Go back

  1. #1
    SitePoint Enthusiast poil11's Avatar
    Join Date
    Aug 2000
    Location
    it look me along time to do that...
    Posts
    99
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    how would you do php refresh that will just send the user back one page?

    how would would you do a javascript refresh that would send the user back one page?

    thanks you for pointing me into the right direction.
    I will Tell you what is wrong with your website and maybe what you can do to make it better.
    Professional Web Site Reviews ... Usability ...
    Contact Me god@stillsucks.com for more information ...
    look at my other reviews, to see what i have done.

  2. #2
    ********* wombat firepages's Avatar
    Join Date
    Jul 2000
    Location
    Perth Australia
    Posts
    1,717
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    javasscript:
    <a href="javascript:history.go(-1)">back</a>

    PHP ? maybe $HTTP_REFERER ?

  3. #3
    JavaScript Guru (Big Ego) Arielladog's Avatar
    Join Date
    Jul 1999
    Location
    SC, USA
    Posts
    390
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey firepages, didn't know you were here

    Anyway, for javascript, you could do firepage's solution, and also:

    <a href="javascript:history.back()">back</a>

    would work.

    For PHP, as firepages said, you could try:

    header("Location: $HTTP_REFERRER");

    aDog

  4. #4
    SitePoint Wizard TWTCommish's Avatar
    Join Date
    Aug 1999
    Location
    Pittsburgh, PA, USA
    Posts
    3,910
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Does $HTTP_REFER work as well? Something inside me is saying it does - could be some bad pizza, though.

    As for JavaScript - the first solution (history.go(-1)) will work, but the history.back one usually does not - at least it doesn't for me, and a few others I've talked with on the subject.

  5. #5
    JavaScript Guru (Big Ego) Arielladog's Avatar
    Join Date
    Jul 1999
    Location
    SC, USA
    Posts
    390
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yoh commish (I loved that show...anyoen know if it ever comes on?),

    what's the dif between al the refer things? I don't know much about PHP so, I'm trying to learn. Where can I find a list of all "innate variables," such as $PHP_SELF, etc...

    As for history.go(-1) vs. history.back(), they both should work, but the newer browsers prefer using go(i) instead of back() and foward(), so history.go(-1) is probably a little better.

    aDog

  6. #6
    Idea Developer
    Join Date
    Sep 2000
    Location
    Bethlehem, PA
    Posts
    521
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    the referer thing works very well.

  7. #7
    SitePoint Evangelist
    Join Date
    May 2000
    Location
    Canada
    Posts
    533
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    personally, i'd use the $HTTP_REFERER way ... i like to keep as much as possible server side .. that way, if something messes up, atleast you wont be blaming "micro$oft" or "netscrape"
    cogito, ergo sum

  8. #8
    SitePoint Evangelist mad-onion's Avatar
    Join Date
    Aug 2000
    Location
    Land of the long white cloud
    Posts
    556
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have always thought needed to have a number in the back and forward function like back(1).
    Maybe 1 is the default, or maybe i am totally wrong but that is ringing inside me!
    And i didnt eat pizza today...lol
    SiteOptions >> Services :: Products :: Contact
    Developers of PHP, C++, Visual Basic, MySQL, and more!

  9. #9
    SitePoint Wizard TWTCommish's Avatar
    Join Date
    Aug 1999
    Location
    Pittsburgh, PA, USA
    Posts
    3,910
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Not sure what it is - but the history.back thing doesn't work for me - so I always use the other method, which works on most browsers.


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
  •