chibineku Posted September 1, 2009 Share Posted September 1, 2009 I would like to be able to detect the name of the form field that a script has been sent via the $_POST variable array. Only one value will be set at a time. So, I need to know $_POST["this_bit"], but I don't know how to reference that.edit: I will explain my idea, so I know if it'll work before I proceed:I want to create a form that displays a user's current personal data and lets them save it. I could have the form handler be one big script that can cope with any and all changes, but I thought it'd be easier to have a little button next to each field and if one is changed, only one form field is posted to the handler at a time, which could then return true or false to the form page. Would that work or do I need AJAX for that? It'd be fun to dust off my AJAX anyway... Link to comment Share on other sites More sharing options...
justsomeguy Posted September 2, 2009 Share Posted September 2, 2009 You can loop through everything in $_POST using foreach: foreach ($_POST as $k => $v){ echo 'key: ' . $k . '; value: ' . $v . '<br>';} You can also use array_keys to get an array of the keys in another array. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.