John Doe
John Doe

Reputation: 2060

Using GET multiple times?

I have used a GET link once and stored the variable on the next page as

 $uniqueid = $_GET["id"];
 echo $uniqueid;

On this page it is echoed and displays properly in the URL. Then on that page I have links set up using GET again.

<a href="2012week1.php?id=<?$uniqueid?>">1 </a>

And on the next page I have the same code...

$uniqueid = $_GET["id"]; echo $uniqueid;

But when the user selects the link it shows the GET in the URL but it is empty. Because of this it echoes nothing. Can you not use GET more than once?? Does anyone have any suggestions or comments??

Upvotes: 0

Views: 230

Answers (2)

Waleed Khan
Waleed Khan

Reputation: 11467

<a href="2012week1.php?id=<?$uniqueid?>">1 </a>

should be

<a href="2012week1.php?id=<?php echo $uniqueid; ?>">1 </a>

Or if you insist on using short tags,

<a href="2012week1.php?id=<?= $uniqueid ?>">1 </a>

Upvotes: 4

tptcat
tptcat

Reputation: 3961

If you're trying to write an inline echo try:

<a href="2012week1.php?id=<?php echo $uniqueid; ?>">1</a>

Upvotes: 1

Related Questions