Yubraj Rai Yubraj Rai - 1 year ago 81
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 Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download