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.
 
 
 
 
 
 

61 lines
1.9 KiB

<?php
$contracttype= "";
$contractno= "";
$company= "";
$taxid= "";
$address= "";
$tel= "";
$promiser= "";
$customerid= "";
$contractperson= "";
$contractaddress= "";
$contracttel= "";
$contractemail= "";
$contract_employee= "";
$start_date= "";
$end_date= "";
$creater= "";
$create_at= "";
$contracttype_error= "";
$contractno_error= "";
$company_error= "";
$taxid_error= "";
$address_error= "";
$tel_error= "";
$promiser_error= "";
$customerid_error= "";
$contractperson_error= "";
$contractaddress_error= "";
$contracttel_error= "";
$contractemail_error= "";
$contract_employee_error= "";
$start_date_error= "";
$end_date_error= "";
$creater_error = "";
$create_at_error = "";
if($_SERVER["REQUEST_METHOD"] == "POST"){
include "contract-user-input.php";
$db_query = "INSERT INTO contract(contracttype, contractno, company, taxid, address, tel, promiser, customerid, contractperson, contractaddress, contracttel, contractemail,contract_employee,start_date,end_date, creater, create_at) VALUES ('$contracttype', '$contractno', '$company', '$taxid', '$address', '$tel', '$promiser', '$customerid', '$contractperson', '$contractaddress', '$contracttel', '$contractemail','$contract_employee','$start_date','$end_date', '$creater', '$create_at')";
$result = mysqli_query($link,$db_query);
$affected = mysqli_affected_rows($link);
mysqli_close($link);
if ($affected > 0) {
echo "<script type ='text/JavaScript'>";
echo "alert('新增成功');";
echo "location.href='contract-index.php?function_name=contract&".$token_link."';";
echo "</script>";
} elseif ($affected == 0) {
echo "<script type ='text/JavaScript'>";
echo "alert('無新增資料');";
echo "location.href='contract-index.php?function_name=contract&".$token_link."';";
echo "</script>";
} else {
echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link);
}
}
?>