JTM
09-17-2002, 09:56 PM
I added an error checking section in my form script and I was wondering if somone can help me out. Instead of doing this:
// define fields
$fields = array ('field1', 'field2', 'field3');
// print the error
if (empty($_POST['fields'])) {
$field1_error='Error';
$field2_error='Error';
$field3_error='Error';
etc.
etc.
I would like to make automatically pull the name of each variable and add the _error to it like:
SOMETHING_error='Error'
This way I won't have to make another line for each field.
Any help would be greatly appreciated.
Thanks,
JTM
// define fields
$fields = array ('field1', 'field2', 'field3');
// print the error
if (empty($_POST['fields'])) {
$field1_error='Error';
$field2_error='Error';
$field3_error='Error';
etc.
etc.
I would like to make automatically pull the name of each variable and add the _error to it like:
SOMETHING_error='Error'
This way I won't have to make another line for each field.
Any help would be greatly appreciated.
Thanks,
JTM
