How do I detect all the names for the field values in a URL in PHP? Is there a function to take all of the strings that come between the "?" and the "=" in a URL or is there a simpler way?

7 Years
Discussion Span
Last Post by CodeBoy101

This is the method to get the value of the field. But if you want to know exactly what is there, you should write a javascript code to fetch the url and extract the strings after ? using substring functions. Then you come to know what there present without using $_GET.

But what is the purpose?

Edited by rajarajan2017: n/a


I'm trying to write AJAX code that will pass all the valid inputs to a PHP page. Of course I'm trying to make the code re-usable. So substring functions are exactly what I'm looking for. I was told that "preg_match" might work. So right now, I'm wondering what the correct regular expression would be.


I was able to answer my own question. I used preg_match_all() to create an array containing all the keys passed in the array.
I used a regular expression to find all the strings between a "&" and "=" after the "?".

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.