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?

check out the contents of the $_GET or $_POST variables.

But what if I don't know the contents of the $_GET and $_POST variables?


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?

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 "?".