Skip to content
Advertisement

PHP Multiple variables in hyperlink

I want to add “max=<?php echo $row_select[‘max_price’] in hyperlink below, so that when the link’s clicked, I can get both min and max price. Please advise how should the code be. Thank you.

Code in page 1

<a href="page2.php? min=<?php echo $row_select['min_price']; ?>">Price</a></td>

In page 2, my code to get min_price is as follows. It works. But I need to bring in max_price from page 1 as well.

$min_price = $_GET['min_price'];
<h2><?php echo $min_price; ?></h2>

Advertisement

Answer

please try code below:

<a href="page2.php?min_price=<?php echo $row_select['min_price']; ?>&max_price=<?php echo $row_select['max_price']; ?>">Price</a></td>


$min_price = $_GET['min_price'];
$max_price = $_GET['max_price'];
<h2><?php echo $min_price; ?></h2>
<h2><?php echo $max_price; ?></h2>
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement