imarockstar Posted November 18, 2008 Share Posted November 18, 2008 IS there away to catch all of the _post variables ... so say I had these from a form ... name="firstname" name="lastname" name="email" On the form action page how could I catch all those ? I have a form with about 50 form fields ... so writing out each _POST variable is a pain !!! any help would be rad !!! Link to comment https://forums.phpfreaks.com/topic/133248-get-all-post-variables/ Share on other sites More sharing options...
trq Posted November 18, 2008 Share Posted November 18, 2008 Depends what you want to do with them exactly, you can however simply loop through the $_POST array. foreach ($_POST as $k => $v) { echo "$k = $v\n"; } Link to comment https://forums.phpfreaks.com/topic/133248-get-all-post-variables/#findComment-693006 Share on other sites More sharing options...
imarockstar Posted November 18, 2008 Author Share Posted November 18, 2008 well I will be updating a database .. So would I still use the above ? b Link to comment https://forums.phpfreaks.com/topic/133248-get-all-post-variables/#findComment-693012 Share on other sites More sharing options...
corbin Posted November 18, 2008 Share Posted November 18, 2008 You could. Link to comment https://forums.phpfreaks.com/topic/133248-get-all-post-variables/#findComment-693044 Share on other sites More sharing options...
PFMaBiSmAd Posted November 18, 2008 Share Posted November 18, 2008 Don't forget to validate that every $k key is a field in your table (to avoid query errors) and to validate and/or escape every $v value to make sure someone is not attempting to inject sql into your query. Link to comment https://forums.phpfreaks.com/topic/133248-get-all-post-variables/#findComment-693051 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.