3
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by diafol
0

You can get PHP parameters (the things after the ?), by using $_GET. In your case you'd go:

$variable = $_GET["user_id"];

Unless I got your question wrong and you're asking something else?

0

Im new to php. Im trying to display data via url. (example) www.mySite.com/usercomment?user_id=1. I would like to let users retreive data by having to type in specific url. Not pageing through data. Any comments, suggestions would be appreciated

What do you mean 'type in an url'. The url given as an example contains a 'querystring' - a list of parameter-value pairs. Don't have your users type this as they probably wouldn't know what to type. These urls are usually pre-written into links. THe previous post mentions using $_GET to retrieve the value - this is correct. However, you could get a nasty error unless you check for its existence first:

if(isset($_GET['user_id'])){
   $user_id = $_GET['user_id'];
}
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.