<?
if (isset($_POST["update"])) // if it's not set, do nothing.
{
include('cond.php');
$idx['Returned'] = array_keys( $_POST['Returned'] );
$idx['2nd'] = array_keys( $_POST['2nd'] );
$idx['3rd'] = array_keys( $_POST['3rd'] );
for(
$i = 0;
$i < min( array_map( 'count', $idx ) );
$i++ )
{
$AN = $idx['Returned'][$i];
$RET = $_POST['Returned'][$AN];
$Chk = $idx['2nd'][$i];
$Val = $_POST['2nd'][$Chk];
$Chk2 = $idx['3rd'][$i];
$Val2 = $_POST['3rd'][$Chk2];
//If date is filled in
if(!empty($RET)){
// store it
$doit = "UPDATE `dbname`.`tname` SET `Returned`= '$RET' WHERE `account_number`='$AN'";
mysql_query($doit) or die('mySQL Error: ' . mysql_error());
}else{
// 2nd isn't filled check 3rd
if (empty($Val)) {
// 3rd is filled in
If(!empty($Val2)) {
print "Third VOR cannot be checked before Second.";
}else{
// 3rd is not set but 2nd is
if(empty($Val2)){
$doit = "UPDATE `dbname`.`tname` SET `Second`='$Val' WHERE `account_number`='$Chk'";
mysql_query($doit) or die('mySQL Error: ' . mysql_error());
}else{
// 2nd and 3rd are set
$doit = "UPDATE `dbname`.`tname` SET `Second`='$Val' ,`Third`='$Val2' WHERE `account_number`='$Chk'";
mysql_query($doit) or die('mySQL Error: ' . mysql_error());
}//end if 2
}//end if
}//end if
}
}}
?>
Ok I used empty/!empty but apparently not in the correct location.
I looked up is_array at http://php.net/manual/en/function.is-array.php but unsure if I can nest it with array_key.
Can you advise location of those things please.
lilRachie