You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

51 lines
2.4 KiB

<?php
include "header.php";
if(isset($_POST['update'])) {
function user_input( $data ) {
$data1 = trim($data);
$data2 = stripslashes($data1);
$data3 = htmlspecialchars($data2);
return $data3;
}
$id = $_POST['id'];
$order_id = user_input($_POST["order_id"]);
$equipment_id = user_input($_POST["equipment_id"]);
$equipment_name = user_input($_POST["equipment_name"]);
$brand = user_input($_POST["brand"]);
$spec = user_input($_POST["spec"]);
$count_type = user_input($_POST["count_type"]);
$price = user_input($_POST["price"]);
$quantity = user_input($_POST["quantity"]);
$total_price = user_input($_POST["total_price"]);
$orderer_id = user_input($_POST["orderer_id"]);
$orderer_name = user_input($_POST["orderer_name"]);
$contact_person = user_input($_POST["contact_person"]);
$tel = user_input($_POST["tel"]);
$address = user_input($_POST["address"]);
$status = user_input($_POST["status"]);
$deliver_no = user_input($_POST["deliver_no"]);
$memo = user_input($_POST["memo"]);
$create_at = date('Y/m/d H:i:s');
$db_query = "UPDATE pre_order set order_id = '$order_id', equipment_id = '$equipment_id', equipment_name = '$equipment_name', brand = '$brand', spec = '$spec',count_type = '$count_type',price = '$price',quantity = '$quantity',total_price = '$total_price',orderer_id = '$orderer_id',orderer_name = '$orderer_name',contact_person = '$contact_person',tel = '$tel',address = '$address',status = '$status',deliver_no = '$deliver_no',memo = '$memo',create_at = '$create_at' WHERE id='$id'";
mysqli_query($link, $db_query);
$affected = mysqli_affected_rows($link);
mysqli_close($link);
if ($affected > 0) {
echo "<script type ='text/JavaScript'>";
echo "alert('update成功');";
echo "location.href='pre_order-index.php?function_name=pre_order&".$token_link."';";
echo "</script>";
} elseif ($affected == 0) {
echo "<script type ='text/JavaScript'>";
echo "alert('無新增資料');";
echo "location.href='pre_order-index.php?function_name=pre_order&".$token_link."';";
echo "</script>";
} else {
echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link);
}
}
?>