Hello everyone!
I am wondering how I can access the ending of my url address.
For exampel: www.castingvault.eu/willy
And I wand the name "willy" only and then process and use it in my php code.

Usually you write the url like this:
www.castingvault.eu/members.php?mem=willy
and the following is how to access it.

$mem = $_GET['mem'];

Then you access the username: willy.

Can anyone help please
Thank you!

//Willy Lukwago

You can use the $_SERVER variable to access the URL.

Look down the page for SCRIPT_NAME

Then you could use explode to split the path by a /
The last array item would then be what you are looking for.

Putting what pritaeas is suggesting to code, it would look something like this:

$path = $SERVER['SCRIPT_NAME'];
echo "\nThe path is: $path";

$pieces = explode('/', $path);
echo "\nThe pieces are:";
var_dump($pieces);

$last = end($pieces);
echo "\nThe last piece is: $last";
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.