<?phpinclude('db.php'); //connectecho '<pre style="text-align: left;">' . print_r($_POST, true) . '</pre>';$id = $_POST['id'];$company_name = mysql_real_escape_string(htmlspecialchars($_POST['companyname']));$delivery_address = mysql_real_escape_string(htmlspecialchars($_POST['deliveryaddress']));$order_date = mysql_real_escape_string(htmlspecialchars($_POST['orderdate']));$delivery_date = mysql_real_escape_string(htmlspecialchars($_POST['deliverydate']));$status = mysql_real_escape_string(htmlspecialchars($_POST['status']));$checked = mysql_real_escape_string(htmlspecialchars($_POST['checked']));$loaded_by = mysql_real_escape_string(htmlspecialchars($_POST['loadedby']));$pallets = mysql_real_escape_string(htmlspecialchars($_POST['sumpallets']));$extra_blocks = mysql_real_escape_string(htmlspecialchars($_POST['sumextras']));$extra_pallets = mysql_real_escape_string(htmlspecialchars($_POST['makeup']));$total_pallets = mysql_real_escape_string(htmlspecialchars($_POST['grandtotal'])); mysql_query("UPDATE order_table SET company_name='$company_name', delivery_address='$delivery_address', order_date='$order_date', delivery_date='$delivery_date', status='$status', hb_checked='$checked', loaded_by='$loaded_by', pallets='$pallets', extra_blocks='$extra_blocks', extra_pallets='$extra_pallets', total_pallets='$total_pallets' WHERE id='$id'")or die(mysql_error()); foreach($_POST['100type'] AS $key=>$value) { // UPDATE 100 TYPEmysql_query("UPDATE order_details_table SET block_quantity='{$_POST['100quantity'][$key]}', block_pallets='{$_POST['100pallets'][$key]}', block_extras='{$_POST['100extras'][$key]}' WHERE order_id='$id'")or die(mysql_error()); }//redirect back to the view page//header("Location: index.html");?>
Array( [id] => 40 [companyname] => Vazelos [deliveryaddress] => LEOFOROS [orderdate] => 2013-04-23 [deliverydate] => 2013-08-22 [status] => Pending [checked] => No [loadedby] => MANOLIS [sumpallets] => 5 [sumextras] => 347 [makeup] => 2 [grandtotal] => 7 [submit] => Update Order [100type] => Array ( [1] => 10.01 [2] => 10.02 [3] => 10.03 [4] => 10.04 [5] => 10.31 [6] => 10.83 [7] => 10.702 [8] => 10.772 [9] => 10.71 [10] => 10.72 [11] => 10.73 [12] => 10.74 ) [100perpallet] => Array ( [1] => 180 [2] => 240 [3] => 360 [4] => 576 [5] => 144 [6] => 288 [7] => 280 [8] => 560 [9] => 360 [10] => 480 [11] => 720 [12] => 1152 ) [100quantity] => Array ( [1] => 654 [2] => 458 [3] => 0 [4] => 0 [5] => 0 [6] => 0 [7] => 0 [8] => 0 [9] => 0 [10] => 0 [11] => 0 [12] => 0 ) [100pallets] => Array ( [1] => 3 [2] => 1 [3] => 0 [4] => 0 [5] => 0 [6] => 0 [7] => 0 [8] => 0 [9] => 0 [10] => 0 [11] => 0 [12] => 0 ) [100extras] => Array ( [1] => 114 [2] => 218 [3] => 0 [4] => 0 [5] => 0 [6] => 0 [7] => 0 [8] => 0 [9] => 0 [10] => 0 [11] => 0 [12] => 0 ))
foreach($_POST['100type'] AS $key=>$value) {$sql = "UPDATE order_details_table SET block_quantity = '{$_POST['100quantity'][$key]}', block_pallets = '{$_POST['100pallets'][$key]}', block_extras = '{$_POST['100extras'][$key]}' WHERE order_id = '$id' AND block_type='{$_POST['100type'][$key]}'";echo $sql;mysql_query($sql) or die(mysql_error()); }