code in page1.php (partial code)
while ($row = mysql_fetch_assoc($result))
{
echo '<a href="page2.php">',($row[0]),'</a>';
}
How can I take the value in $row[0] to page2.php?
Basically i want to use that value in page2.php to run a mysql query. Am I on the right track by using <a href="page2.php"></a>
here?..
Any advice is appreciated.
Please let me know if my question is not clear.. i will try my best to word it better.
thanks for the help.
One possible way would be:
while ($row = mysql_fetch_assoc($result))
{
echo '<a href="page2.php?value1=' . $row[0] .'">Link Text</a>';
}
Then on the second page, you can access that variable using $_GET['value1']
In this example, you are taking values out of the database and sticking them in the query string. Just be sure you don't do it the other way around without sanitizing them!
To do two, do it like this:
echo '<a href="page2.php?value1=' . $row[0] .'&value2=' . $row[1] .'">Link Text</a>';