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.
44 lines
2.0 KiB
44 lines
2.0 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'];
|
|
$deliver_no = user_input($_POST["deliver_no"]);
|
|
$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"]);
|
|
$total_price_equipments = user_input($_POST["total_price_equipments"]);
|
|
$delivery_fee = user_input($_POST["delivery_fee"]);
|
|
$tax_fee = user_input($_POST["tax_fee"]);
|
|
$summation = user_input($_POST["summation"]);
|
|
$create_at = user_input($_POST["create_at"]);
|
|
|
|
$db_query = "UPDATE delivery_info set deliver_no = '$deliver_no', orderer_id = '$orderer_id', orderer_name = '$orderer_name', contact_person = '$contact_person', tel = '$tel', address = '$address', total_price_equipments = '$total_price_equipments', delivery_fee = '$delivery_fee', tax_fee = '$tax_fee', summation = '$summation', create_at = '$create_at' WHERE id='$id'";
|
|
mysqli_query($link, $db_query);
|
|
header("location: delivery_info-index.php");
|
|
$affected = mysqli_affected_rows($link);
|
|
mysqli_close($link);
|
|
if ($affected > 0) {
|
|
echo "<script type ='text/JavaScript'>";
|
|
echo "alert('update成功');";
|
|
echo "location.href='delivery_info-index.php?function_name=delivery_info&".$token_link."';";
|
|
echo "</script>";
|
|
} elseif ($affected == 0) {
|
|
echo "<script type ='text/JavaScript'>";
|
|
echo "alert('無新增資料');";
|
|
echo "location.href='delivery_info-index.php?function_name=delivery_info&".$token_link."';";
|
|
echo "</script>";
|
|
} else {
|
|
echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link);
|
|
}
|
|
}
|
|
?>
|