Ignoring fields with script that checks empty fields


#1

Here is part of the form that I have, the script checks for empty fields and redisplays the form. The code for $allowed_fields is to ignore field $L1 through $L20.

What I need is the code to modify this to also ignore field $xcheck1 and $tchecka individually.

[code] /* set up array of field labels */
$label_array = array ( “List_title” => “List_title”,
“Short_title” => “Short_title”,
“VIN” => “VIN”,
“ID” => “ID”,
“Engine” => “Display_engine”,
“Transmission” => “Transmission”,
“Color” => “Color”,
“Miles” => “Miles”,
“Display_miles” => “Display_miles”,
“Style” => “Style”,
“Make” => “Make”,
“Price” => “Price”,
“Display_price” => “Display_price”,
“Year” => “Year”);
$allowed_fields = array();

$i = 0;
while($i < 20)
{
$i++;
$allowed_fields[] = ‘L’ . $i;
}

foreach ($HTTP_POST_VARS as $key => $value)
{
/* check each field for blank fields */
if ($value == "" && !in_array($key, $allowed_fields))
{[/code]

#2

Try the following:

[php]
$allowed_fields[] = “$xcheck1”;
$allowed_fields[] = “$xchecka”;
[/php]

But I won’t tell you where to put it :wink: