URL use "/" instead of "?" to send variables

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
rahulephp
Forum Commoner
Posts: 28
Joined: Mon Oct 05, 2009 11:05 am

URL use "/" instead of "?" to send variables

Post by rahulephp »

Hi,
In normal php, We use ?id=123 to send variable through URL.

So, the URL would be www.example.com/page.php?id=123 and then we use $_REQUEST['id'] to receive the variable on another page.

But my question is, if I use "/" instead of "?" (Ex: www.example.com/page.php/id/123), then how to receive the "id" on page.php.

$_REQUEST['id'] doesn't works in this case.

Thank you in advance
cpetercarter
Forum Contributor
Posts: 474
Joined: Sat Jul 25, 2009 2:00 am

Re: URL use "/" instead of "?" to send variables

Post by cpetercarter »

You need to learn about how to use an .htaccess file and the Apache rewrite module to rewrite URLs. Start by googling "url rewriting".
Post Reply