Yubraj Rai Yubraj Rai - 4 months ago 10x
PHP Question

$_GET['id'] is not receiving id value

I was trying to retrieve $id in category.php value from the another page sidebar.php. but i couldn't receive the value of id.

Sending script in sidebar.php

<a href = "category.php? id = <?php echo $row['id'];?>"><?php echo $row['title'];?></a>

receiving script in category.php

$id = $_GET['id'];

$id is not having any value but false.

I tried my best to resolve this issue but couldn't. can anyone help me out with solution?


You need to change your code from:

<a href = "category.php? id = <?php echo $row['id'];?>"><?php echo   $row['title'];?></a>


<a href = "category.php?id=<?php echo $row['id'];?>"><?php echo   $row['title'];?></a>

Remove the extra spaces before and after the id. Hope this helps.