I want to get query string from a url and change it to the string format.
I copied the following code from other related posts on stackoverflow, but it is not working properly for me.
<?php
$url="www.example.com/user.php?uname=alan&password=2222";
$parse=parse_str($url);
echo $uname;
echo $password;
This code returns the second variable $password as expected, but it failed for the first variable $uname
undefined variable: uname
Is there something missing in the code?
Any help is greatly appriciated!
Thanks.
?.