OK, I will show you how my code works and you can maybe then help me with my problem:
<?php require_once('Connections/mysqli_connect.php'); ?>
<?php
establish connection
then other stuff not related to this issue
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
function Money($float) {
return sprintf("%01.2f", $float);
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "smartform")) {
$insertSQL = sprintf("INSERT INTO daily_sales (record_date, new_date, weekday, currency_am, currency_pm, currency_total, coin_am, coin_pm, coin_total, check_am, check_pm, check_total, cc_am, cc_pm, cc_total, cpo_am_total, cpo_pm_total, cpo_total, gross_sales_am, gross_sales_pm, gross_sales_total, wost_am, wost_pm, wost_total, tst_am, tst_pm, tst_total, cpo_am_1, cpo_pm_1, cpo_shift_total_1, cpo_am_2, cpo_pm_2, cpo_shift_total_2, cpo_am_3, cpo_pm_3, cpo_shift_total_3, gross_sales_am2, gross_sales_pm2, gross_sales_total2, ticket_am, ticket_pm, ticket_total, over_short_am, over_short_pm, over_short_total, cpo_am_item_1, cpo_am_item_2, cpo_am_item_3, server1_name, server2_name, server3_name, server4_name, server5_name, serv1_cc_am, serv1_cc_pm, serv1_cc_total, serv2_cc_am, serv2_cc_pm, serv2_cc_total, serv3_cc_am, serv3_cc_pm, serv3_cc_total, serv4_cc_am, serv4_cc_pm, serv4_cc_total, serv5_cc_am, serv5_cc_pm, serv5_cc_total, serv_cc_am_total, serv_cc_pm_total, serv_cc_total, mtd_sales, ytd_sales, mtd_tax, ytd_tax, serv_cc_total2, mtd_cc, gca_am, gca_pm, gca_total, adstm, save_date) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['record_date'], "text"),
GetSQLValueString($_POST['new_date'], "text"),
GetSQLValueString($_POST['weekday'], "text"),
GetSQLValueString(Money($_POST['currency_am'], "text")),
GetSQLValueString(Money($_POST['currency_pm'], "text")),
GetSQLValueString(Money($_POST['currency_total'], "text")),
GetSQLValueString(Money($_POST['coin_am'], "text")),
GetSQLValueString(Money($_POST['coin_pm'], "text")),
GetSQLValueString(Money($_POST['coin_total'], "text")),
GetSQLValueString(Money($_POST['check_am'], "text")),
GetSQLValueString(Money($_POST['check_pm'], "text")),
GetSQLValueString(Money($_POST['check_total'], "text")),
GetSQLValueString(Money($_POST['cc_am'], "text")),
GetSQLValueString(Money($_POST['cc_pm'], "text")),
GetSQLValueString(Money($_POST['cc_total'], "text")),
GetSQLValueString(Money($_POST['cpo_am_total'], "text")),
GetSQLValueString(Money($_POST['cpo_pm_total'], "text")),
GetSQLValueString(Money($_POST['cpo_total'], "text")),
GetSQLValueString(Money($_POST['gross_sales_am'], "text")),
GetSQLValueString(Money($_POST['gross_sales_pm'], "text")),
GetSQLValueString(Money($_POST['gross_sales_total'], "text")),
GetSQLValueString(Money($_POST['wost_am'], "text")),
GetSQLValueString(Money($_POST['wost_pm'], "text")),
GetSQLValueString(Money($_POST['wost_total'], "text")),
GetSQLValueString(Money($_POST['tst_am'], "text")),
GetSQLValueString(Money($_POST['tst_pm'], "text")),
GetSQLValueString(Money($_POST['tst_total'], "text")),
GetSQLValueString(Money($_POST['cpo_am_1'], "text")),
GetSQLValueString(Money($_POST['cpo_pm_1'], "text")),
GetSQLValueString(Money($_POST['cpo_shift_total_1'], "text")),
GetSQLValueString(Money($_POST['cpo_am_2'], "text")),
GetSQLValueString(Money($_POST['cpo_pm_2'], "text")),
GetSQLValueString(Money($_POST['cpo_shift_total_2'], "text")),
GetSQLValueString(Money($_POST['cpo_am_3'], "text")),
GetSQLValueString(Money($_POST['cpo_pm_3'], "text")),
GetSQLValueString(Money($_POST['cpo_shift_total_3'], "text")),
GetSQLValueString(Money($_POST['gross_sales_am2'], "text")),
GetSQLValueString(Money($_POST['gross_sales_pm2'], "text")),
GetSQLValueString(Money($_POST['gross_sales_total2'], "text")),
GetSQLValueString(Money($_POST['ticket_am'], "text")),
GetSQLValueString(Money($_POST['ticket_pm'], "text")),
GetSQLValueString(Money($_POST['ticket_total'], "text")),
GetSQLValueString(Money($_POST['over_short_am'], "text")),
GetSQLValueString(Money($_POST['over_short_pm'], "text")),
GetSQLValueString(Money($_POST['over_short_total'], "text")),
GetSQLValueString($_POST['cpo_am_item_1'], "text"),
GetSQLValueString($_POST['cpo_am_item_2'], "text"),
GetSQLValueString($_POST['cpo_am_item_3'], "text"),
GetSQLValueString($_POST['server1_name'], "text"),
GetSQLValueString($_POST['server2_name'], "text"),
GetSQLValueString($_POST['server3_name'], "text"),
GetSQLValueString($_POST['server4_name'], "text"),
GetSQLValueString($_POST['server5_name'], "text"),
GetSQLValueString($_POST['serv1_cc_am'], "text"),
GetSQLValueString($_POST['serv1_cc_pm'], "text"),
GetSQLValueString($_POST['serv1_cc_total'], "text"),
GetSQLValueString($_POST['serv2_cc_am'], "text"),
GetSQLValueString($_POST['serv2_cc_pm'], "text"),
GetSQLValueString($_POST['serv2_cc_total'], "text"),
GetSQLValueString($_POST['serv3_cc_am'], "text"),
GetSQLValueString($_POST['serv3_cc_pm'], "text"),
GetSQLValueString($_POST['serv3_cc_total'], "text"),
GetSQLValueString($_POST['serv4_cc_am'], "text"),
GetSQLValueString($_POST['serv4_cc_pm'], "text"),
GetSQLValueString($_POST['serv4_cc_total'], "text"),
GetSQLValueString($_POST['serv5_cc_am'], "text"),
GetSQLValueString($_POST['serv5_cc_pm'], "text"),
GetSQLValueString($_POST['serv5_cc_total'], "text"),
GetSQLValueString($_POST['serv_cc_am_total'], "text"),
GetSQLValueString($_POST['serv_cc_pm_total'], "text"),
GetSQLValueString($_POST['serv_cc_total'], "text"),
GetSQLValueString(Money($_POST['mtd_sales'], "text")),
GetSQLValueString(Money($_POST['ytd_sales'], "text")),
GetSQLValueString(Money($_POST['mtd_tax'], "text")),
GetSQLValueString(Money($_POST['ytd_tax'], "text")),
GetSQLValueString($_POST['serv_cc_total2'], "text"),
GetSQLValueString($_POST['mtd_cc'], "text"),
GetSQLValueString(Money($_POST['gca_am'], "text")),
GetSQLValueString(Money($_POST['gca_pm'], "text")),
GetSQLValueString(Money($_POST['gca_total'], "text")),
GetSQLValueString(Money($_POST['adstm'], "text")),
GetSQLValueString(date("Y-m-d H:i:s",time()),"text") );
mysql_select_db("restaurant_db", $conn) or die(mysql_error());
$Result1 = mysql_query($insertSQL, $conn) or die(mysql_error());
Other stuff not related to this issue
DatePicker link
CSS stuff
Javascript stuff
<body ...>
<form method="POST" autocomplete="on" NAME="smartform" action="<?php echo $editFormAction; ?>< onSubmit="clickedButton">
<table ...>
<tr>
<td height="26" align="center">
<input onBlur="mark(this,'#ffffff','#000000'); this.value=this.value.replace(/,/g,''); this.value=formatCurrency(this.value);" type="text" style="text-align: right" name="currency_am" value="" size="11" id="currency_am" class="fields3" onChange="calcincome(this.form,'currency_am','Currency for Day Shift'); formatCurrency(currency_am);" onFocus="nextfield='coin_am'; mark(this,'#c7dcf9','#688bac')" />
</td>
</tr>
<tr>
<td height="26" align="center">
<input onBlur="mark(this,'#ffffff','#000000'); this.value=this.value.replace(/,/g,''); this.value=formatCurrency(this.value);" type="text" style="text-align: right" name="coin_am" value="" size="11" id="coin_am" class="fields3" onChange="calcincome(this.form,'coin_am','Coin for Day Shift');" onFocus="nextfield='check_am'; mark(this,'#c7dcf9','#688bac')" />
</td>
</tr>
</table>
<input name="new_date" type="hidden" value="<?php echo $row_rsRecordData['new_date']; ?>">
<input TYPE="submit" name="submit" value="Submit" onClick="clickedButton=true">
</p>
<p> </p>
<input type="hidden" name="MM_insert" value="smartform">
</form>