|
Posted by Steve on 08/24/07 04:27
| However, I have done this before using
| $_POST['<--hardCodedValueGoesHere-->'] = NULL;. I was wondering if there
| was a way to accomplish this with a loop structure instead of longhand,
| line-by-line for each form value....particularly if I have a form with 30+
| fields which I am required to build.
<snip>
| The reason I want to do what I want to do is two-fold:
|
| 1. Preserve entered data in the fields in case the form is not properly
| filled out.
which setting posted variables to null accomplished...in reverse. ;^)
| 2. Use an array structure for error checking and changing the CSS
| properties to visually indicate an error on the page.
which has nothing to do with setting the $_POST *array* values to null.
| --Like I said, I've done this before, I'm just looking for a short form
way
| to do it.
function senselessButAskedFor(&$value)
{
$value = null;
}
array_walk('senselessButAskedFor', $_POST);
short enough?
Navigation:
[Reply to this message]
|