Hi
I am trying to establish a query whereby I can check if a user has missed a field in a form.
I have multiple rows of records, each has the same field names, I want to check if they have missed on field on one row
example field names (column headings)
colour / size / code / price
and there are 20 rows of fields below this to fill in the information
the fields colour and size are already filled in (populated by a query on the mysql database)
I want a query to see if code is empty but price has been filled in.
I already have a query that checks to see if code is empty but this is no use to me as sometimes the user doesn't fill in all the rows (they are allowed to do this !) and with the current query it outputs the error message becuase all the code fields are empty.
I want a query that says if code is empty but price is not empty then error, but if code is empty and price is empty then OK.....
so far I am playing around with empty() but cannot get the syntax correct.
if(is_array($_POST['code']) && count($_POST['code'])>0)
{
foreach($_POST['code'] as $value)
{
if (empty($_POST['code'])) AND (!empty(_POST['price']))
{
$empty=false;
}
elseif (empty($_POST['code'])) && (empty(_POST['price']))
{
$empty=true;
}
}
} if($empty)
{
echo "error message";
}
}
if(!$empty)
{ // run the code to insert info into database }
I get a parse error on the line
if (empty($POST['code'])) AND (!empty(POST['price']))
any ideas anyone - thanks