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.
50 lines
2.5 KiB
50 lines
2.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'];
|
|
$fixnumber = user_input($_POST["fixnumber"]);
|
|
$customerid = user_input($_POST["customerid"]);
|
|
$contractno = user_input($_POST["contractno"]);
|
|
$facilityno = user_input($_POST["facilityno"]);
|
|
$damage_detail = user_input($_POST["damage_detail"]);
|
|
#$file_path = user_input($_POST["file_path"]);
|
|
$contact_person = user_input($_POST["contact_person"]);
|
|
$contact_number = user_input($_POST["contact_number"]);
|
|
$repairerid = user_input($_POST["repairerid"]);
|
|
$repairername = user_input($_POST["repairername"]);
|
|
$phone_call_help = user_input($_POST["phone_call_help"]);
|
|
$actual_repairerid = user_input($_POST["actual_repairerid"]);
|
|
$actual_repairername = user_input($_POST["actual_repairername"]);
|
|
$progress_flag = user_input($_POST["progress_flag"]);
|
|
$memo = user_input($_POST["memo"]);
|
|
$create_date = user_input($_POST["create_date"]);
|
|
$start_date = user_input($_POST["start_date"]);
|
|
$end_date = user_input($_POST["end_date"]);
|
|
|
|
$db_query = "UPDATE repair set fixnumber = '$fixnumber', customerid = '$customerid', contractno = '$contractno', facilityno = '$facilityno', damage_detail = '$damage_detail', contact_person = '$contact_person', contact_number = '$contact_number', repairerid = '$repairerid', repairername = '$repairername', phone_call_help = '$phone_call_help', actual_repairerid = '$actual_repairerid', progress_flag = '$progress_flag', memo = '$memo',create_date = '$create_date',start_date = '$start_date',end_date = '$end_date' 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='repair-index.php?function_name=repair&".$token_link."';";
|
|
echo "</script>";
|
|
} elseif ($affected == 0) {
|
|
echo "<script type ='text/JavaScript'>";
|
|
echo "alert('無新增資料');";
|
|
echo "location.href='repair-index.php?function_name=repair&".$token_link."';";
|
|
echo "</script>";
|
|
} else {
|
|
echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link);
|
|
}
|
|
}
|
|
?>
|