Hi! I need help adding a variable to a link. Here's the code <?php $row="sleep"; print '<a href="page.php?">Shoe</a>'; ?> PHP: I want to add it right after the ?
Are you trying to append it after page.php? You can break in and out of quotes as you please and append strings together with a period (.). For for example: print '<a href="page.php?' . $row . '">Shoe</a>'; PHP: Alternatively you could do print '<a href="page.php?{$row}">Shoe</a>'; PHP:
It works! But I have another question. I also want to display the variable inside the URL into another page. Here's the code for the other page <?php $dude=$_GET['$row']; print $dude; ?> PHP:
never mind, got it! here's the code <?php $row="sleep"; print '<a href="page.php?brand=' . $row . '">Shoe</a>'; ?> PHP: and here's the code for the page.php <?php $dude=$_GET['brand']; print $dude; ?> PHP:
Ok Look At this Below; This is /index.php <?php $row="sleep"; print '<a href="page.php?{$row}">Shoe</a>'; ?> PHP: This is /page.php?sleep <?php include("menu.php"); $dude=$_GET['$row']; print $dude; ?> PHP: Hope this helps :0