Guest User

Untitled

a guest
Dec 12th, 2018
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. <?php
  2.  
  3. // check if query string is single or array
  4. $rows = explode("&", $_SERVER['QUERY_STRING']);
  5.  
  6. if ( count( $rows ) > 1 )
  7. echo 'query string contains more than one query string value' ;
  8.  
  9. // Get filter from query string
  10. // 1 parameter only
  11. $qs = ( isset ( $_GET['filter']) ) ? htmlspecialchars( $_GET["filter"] ) : '' ;
  12. echo $qs ;
  13. // echo ( isset ( $_GET['filter']) ) ? htmlspecialchars( $_GET["filter"] ) : '' ;
  14.  
  15.  
  16. // for multiple query string filters
  17. $queries = array();
  18. parse_str( $_SERVER['QUERY_STRING'], $queries);
  19.  
  20. echo '<pre>' ;
  21. print_r( $queries ) ;
  22. echo '</pre>' ;
  23. exit() ;
Add Comment
Please, Sign In to add comment