Yubraj Rai Yubraj Rai - 5 months ago 20
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?

Answer

You need to change your code from:

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

to:

<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.

Comments