Skip to content
Advertisement

how to get value using get method from php

below is url : http://test.com/admin.php?&state=JAMMU+&KASHMIR

using get method i want value of parameter state.

thanks for help

Advertisement

Answer

Try the below code

echo $_GET['state'];

Update:

To get & as a value in GET variable it first need to be encoded i.e., The url would be

'https://www.test.com/admin.php?&state='.urlencode('JAMMU+&KASHMIR')

echo urldecode($_GET['state']);
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement