Paul Paul - 1 year ago 64
PHP Question

How to obtain part of the url with php

I am coming up with a way to display user profiles. Right now I am able to insert the user_id into the url when going to a user's profile, but I am unsure of how to get the user_id from the url.

So at the end of the url I have this:


I just want to be able to get the 41 (please note this number will change per profile) and then set it to a variable.

How would I do this?

Answer Source
    echo $_GET['user'];

all the parameters of the url are stored in the $_GET variable...

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