studgate Posted December 5, 2008 Share Posted December 5, 2008 Hey Guys, I want to check if a url contains a query string or not. How do I go about doing that?? What I am looking for is a simple code of function that checks the url and if there is no query string, show this and if there is query string show that. I hope I explain it right. Thanks in advance guys! Example: if querystring() { echo '&'; } else { echo '?'; } Link to comment https://forums.phpfreaks.com/topic/135588-solved-query-string-question/ Share on other sites More sharing options...
The Little Guy Posted December 5, 2008 Share Posted December 5, 2008 if(!isset($_SERVER['QUERY_STRING']) || empty($_SERVER['QUERY_STRING'])){ echo 'No Query String'; }else{ echo $_SERVER['QUERY_STRING']; } Link to comment https://forums.phpfreaks.com/topic/135588-solved-query-string-question/#findComment-706379 Share on other sites More sharing options...
studgate Posted December 5, 2008 Author Share Posted December 5, 2008 yep, that works!! thanks Little Guy! Link to comment https://forums.phpfreaks.com/topic/135588-solved-query-string-question/#findComment-706397 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.