0

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??

2 Answers 2

4
<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> 
Sign up to request clarification or add additional context in comments.

1 Comment

Just be careful if you use short tags and then have to move to a pre 5.4 environment they could turned off and you may not be allowed to enable them.
1

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

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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.