php - How to know whether i have clicked the particular link in the next page
791
I have created certain links using afor
loop in PHP.
foreach($storage as $val)
{
if($val!="")
{
echo "$val";
echo "<a href=\"b.html\">Link</a>";
}
}
Page will look like
content1 Link to b.html
content2 Link to b.html
content3 Link to b.html
content4 Link to b.html
...
...
In the next page I want to retrieve the correct content based on the link clicked. Example: If I click the second link the content to be retrieved is "content2".
How can I accomplish this?
Answer
Solution:
Create your links like that:
Then, on the other page, use this code:
Then
$content
contains whatever was passed in the URL - or an empty string if the param was missing.Answer
Solution:
You could set Get parameters so that your links are to b.html?var=content2
Then you can just read the Get Parameters
and you can then view this value with