I'm not exactly new to PHP, but I'm new enough to ask a stupid question.
I searched around for quite a while trying to figure this out, but either didn't find it or didn't know it when I saw it. Basically, I'm lazy and want the $_POST array to handle itself; I don't want to type out "$fieldName = $_POST['fieldName'] ; " one million times.
I figure the way to start is something like this:
Code: Select all
foreach ($_POST as $key => $value) {
$key = "usr_" . $key ;
// I like for variables the user entered to be called $usr_whatever -- personal preference, I guess
$value = trim(stripslashes($value)) ;
// And here's where I don't know what to do next.
}