Ok - I have created 8 file fields with 8 separate image uploads and 8 seperate inserts. These all upload the image and upload the file name to the database. The problem I have is that if a file field is empty a blank record gets inserted into the database. I have tried adding isset($_POST['image1']) at the beginning of each of the insert codes ie.
// WA Application Builder Insert
if (isset($_POST["Insert_x"]) && isset($_POST['image1'])) // Trigger
{
$WA_connection = $exclusive;
$WA_table = "resortimages";
$WA_sessionName = "resortimages_resortimagesID";
$WA_redirectURL = "";
$WA_keepQueryString = false;
$WA_indexField = "resortimagesID";
$WA_fieldNamesStr = "resortID|image";
$WA_fieldValuesStr = "".$_SESSION['WADA_Insert_resortdetails'] ."" . "|" . "".$WA_DFP_UploadStatus["WA_UploadResult1"]["serverFileName"] ."";
$WA_columnTypesStr = "none,none,NULL|',none,''";
$WA_fieldNames = explode("|", $WA_fieldNamesStr);
$WA_fieldValues = explode("|", $WA_fieldValuesStr);
$WA_columns = explode("|", $WA_columnTypesStr);
$WA_connectionDB = $database_exclusive;
mysql_select_db($WA_connectionDB, $WA_connection);
if (!session_id()) session_start();
$insertParamsObj = WA_AB_generateInsertParams($WA_fieldNames, $WA_columns, $WA_fieldValues, -1);
$WA_Sql = "INSERT INTO `" . $WA_table . "` (" . $insertParamsObj->WA_tableValues . ") VALUES (" . $insertParamsObj->WA_dbValues . ")";
$MM_editCmd = mysql_query($WA_Sql, $WA_connection) or die(mysql_error());
$_SESSION[$WA_sessionName] = mysql_insert_id();
if ($WA_redirectURL != "") {
if ($WA_keepQueryString && $WA_redirectURL != "" && isset($_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] !== "" && sizeof($_POST) > 0) {
$WA_redirectURL .= ((strpos($WA_redirectURL, '?') === false)?"?":"&").$_SERVER["QUERY_STRING"];
}
header("Location: ".$WA_redirectURL);
}
}
?>
But then nothing gets inserted into the database.


