-2

Possible Duplicate:
How can I do a “back” link on PHP pages?

Can someone please show me where i am going wrong. I have a link accessible from various pages that goes to another page, once the user is done on that page they can click a link 'back' which should take them to the previous page they was on.

I am trying to use the following code but it won't respond, won't link to anywhere and just stays on the current page.

If anyone can offer a way of doing what i am trying to achieve that be great thanks.

<a href="<?php $_SERVER['HTTP_REFERER'] ?>"><< Back</a>
Community
  • 1
  • 1
Matthew Taylor
  • 25
  • 1
  • 1
  • 6

1 Answers1

5

You need to echo the result.

<a href="<?php echo $_SERVER['HTTP_REFERER']; ?>"><< Back</a>

Otherwise, PHP will not print anything.

RageD
  • 6,693
  • 4
  • 30
  • 37