-2

Lests say I have a basic loop:

<? $count = 0; 

while ( $count < 20 ):      
$count++; ?>

**$page = 'unique value which changes every time it counts, it loops';**

<a href="http://www.mysite.com/page.php">Link<? echo $count; ?></a>

<? endwhile; ?>

I need a ajax/javascript code (does not matter really) for when I click lets say link nr 16 (displayed from the while loop) it sends me the $page variable with the content for link nr. 16. Not really sure how to make myself understood :( Sorry if my q sounds unclear.

Please, no php methonds, not get or session variables

webmasters
  • 5,663
  • 14
  • 51
  • 78

2 Answers2

0

I think you are talking about the get variables

Try this.

<a href="http://www.mysite.com/page.php?page=<? echo $page; ?>">Link<? echo $count; ?></a>

and you can get the value of $page variable in page.php like this

echo $_GET['page']
Shakti Singh
  • 84,385
  • 21
  • 134
  • 153
0

ok,from what i understand, you need a javascript function binded on the onclick event of the generated links that sends you back to a different page the link content. if that's what you need, i recommend using a library such as jquery (it's more easy ti use) and paste this code into the page:
$('a').click(function(){
$.post("url_of_the_page_you_want_to_send",
{data : $(this).html()}); });

hope this helps :|

gion_13
  • 41,171
  • 10
  • 96
  • 108