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.
49 lines
2.3 KiB
49 lines
2.3 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'];
|
|
$contractno = user_input($_POST["contractno"]);
|
|
$facilityno = user_input($_POST["facilityno"]);
|
|
$customerid = user_input($_POST["customerid"]);
|
|
$weight = user_input($_POST["weight"]);
|
|
$numberofstop = user_input($_POST["numberofstop"]);
|
|
$numberoffloor = user_input($_POST["numberoffloor"]);
|
|
$opentype = user_input($_POST["opentype"]);
|
|
$speed = user_input($_POST["speed"]);
|
|
$repairtype = user_input($_POST["repairtype"]);
|
|
$longitude = user_input($_POST["longitude"]);
|
|
$latitude = user_input($_POST["latitude"]);
|
|
$address = user_input($_POST["address"]);
|
|
$repairerid = user_input($_POST["repairerid"]);
|
|
$repairername = user_input($_POST["repairername"]);
|
|
$creater = user_input($_POST["creater"]);
|
|
$create_at = date('Y/m/d H:i:s');
|
|
|
|
$db_query = "UPDATE facility set contractno = '$contractno', facilityno = '$facilityno', customerid = '$customerid', weight = '$weight', numberofstop = '$numberofstop', numberoffloor = '$numberoffloor',opentype = '$opentype',speed = '$speed',repairtype = '$repairtype',longitude = '$longitude',latitude = '$latitude',address = '$address',repairerid = '$repairerid',repairername = '$repairername',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='facility-index.php?function_name=facility&".$token_link."';";
|
|
echo "</script>";
|
|
} elseif ($affected == 0) {
|
|
echo "<script type ='text/JavaScript'>";
|
|
echo "alert('無新增資料');";
|
|
echo "location.href='facility-index.php?function_name=facility&".$token_link."';";
|
|
echo "</script>";
|
|
} else {
|
|
echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link);
|
|
}
|
|
}
|
|
?>
|