how can I optimize this...
I have a form.
I have 3 tables in a db. (assecories, products, lookup)
in my form, I have 14 check boxes. you can select more than 1. This information goes into the lookup. The code is as follows:
<?php
// WA Application Builder Insert
if ($_SERVER["REQUEST_METHOD"] == "POST") // Trigger
{
$WA_connection = $connNews;
$WA_table = "lookup";
$WA_sessionName = "lookup_accessory_ID";
$WA_redirectURL = "";
$WA_keepQueryString = false;
$WA_indexField = "accessory_ID";
$WA_fieldNamesStr = "accessory_ID|product_ID";
$WA_fieldValuesStr = "".$_SESSION['accessories_accessory_ID'] ."" . "|" . "".((isset($_POST["duo"]))?$_POST["duo"]:"") ."";
$WA_columnTypesStr = "',none,''|',none,''";
$WA_fieldNames = explode("|", $WA_fieldNamesStr);
$WA_fieldValues = explode("|", $WA_fieldValuesStr);
$WA_columns = explode("|", $WA_columnTypesStr);
$WA_connectionDB = $database_connNews;
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);
}
}
?>
This line is question is:
$WA_fieldValuesStr = "".$_SESSION['accessories_accessory_ID'] ."" . "|" . "".((isset($_POST["duo"]))?$_POST["duo"]:"") ."";
I thought I could just duplicate this 14 times. Doest work
Do I have to do a "DataAssist>>insert record" 13 more times? I would think there is a way to optimize this.
thanks