there are many links created dynamically in my html code and I want to redirect to another page using the one user clicks. but i get a wrong $_SESSION[‘recipeid’] each time I click one of the links.
here is my code in html:
<div class="search1recipes">
<div>
<div class="recipepicturediv">
<?php $source = "Images/" . $recipe['picture']; ?>
<img src="<?php echo $source;?>" alt="<?php echo $recipe['title'];?>" style="width:250px; height:200px;">
</div>
<div class="recipeinfodiv">
<p style="color: #660000;"> Country: <?php echo $country; ?> City: <?php echo $city; ?> </p>
<p style="color: #730099;"> Name: <?php echo $recipe['title']; ?> </p>
<p style="color: #000099;"> Preparation Time: <?php echo $recipe['preptime']; ?> Cooking Time: <?php echo $recipe['cookingtime']; ?> </p>
<a href="detailrecipe.php" <?php $_SESSION['recipeid'] = $recipe['recipeid'];?> > See Recipe </a>
</div>
</div>
</div>
<?php endforeach; ?>