Jump to content

hyperlink value

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
2 replies to this topic

#1
welton122

welton122

    Learning Programmer

  • Members
  • PipPipPip
  • 76 posts
hi all,

ok basically I am working on a project which requires me to use hyperlinks. The problem i am having is that when the user clicks on a link i need a value to be passed to the page it links to, like a form does with the value="" option.

Is this possible???? and if Yes how do i do it????

my first guess was that it would be somthing like

<a value="1" href="#">Link</a>

But then I didnt know how I would get the value on the next page??

Any help on this?

Many Thanks,
J

#2
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,124 posts
Data sent between posts is best done through a GET request, here we will assign '1' to 'value' to be sent to the next page:
<a href="page.php?value=1">Link</a>  
You can make it dynamic as well, such as:
$page = 1;
echo "<a href='page.php?value=$page'>Link</a>";

To access it on page.php:
$value = $_GET['value']; //page.php?value=1

Does this answer your question?
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.

#3
welton122

welton122

    Learning Programmer

  • Members
  • PipPipPip
  • 76 posts
yes thanks, that exactly what i was looking for. Thanks for the reply. :D