I am building a function that will validate the values in a form.
How can I extract the actual name in string form from a $_POST variable?
Ex: $_POST[‘first_name’] = ‘Joe’;
I now want to grab the string ‘first_name’ and use it in a function to declare a variable by that name. I know I can use a foreach loop but isn’t there an easier way to do this?
As far as I understood, you are looking for
array_keys($_POST).