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.
 
 
 
 
 
 

38 lines
1.5 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["delivery_no"]);
$issue_time = user_input($_POST["issue_time"]);
$location = user_input($_POST["location"]);
$memo = user_input($_POST["memo"]);
$creater = user_input($_POST["creater"]);
$create_at = date('Y/m/d H:i:s');
$db_query = "UPDATE delivery_log set deliver_no = '$deliver_no', issue_time = '$issue_time', location = '$location', 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='delivery_log-index.php?function_name=delivery_log&".$token_link."';";
echo "</script>";
} elseif ($affected == 0) {
echo "<script type ='text/JavaScript'>";
echo "alert('無新增資料');";
echo "location.href='delivery_log-index.php?function_name=delivery_log&".$token_link."';";
echo "</script>";
} else {
echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link);
}
}
?>