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.
113 lines
3.9 KiB
113 lines
3.9 KiB
<?php
|
|
include "header.php";
|
|
|
|
$id = isset($_GET['id']) ? $_GET['id'] : die('ERROR: Record ID not found.');
|
|
|
|
$data = array();
|
|
// sql語法存在變數中
|
|
$db_query = "SELECT * FROM equipment WHERE id=$id";
|
|
|
|
// 用mysqli_query方法執行(sql語法)將結果存在變數中
|
|
$data = mysqli_query($link,$db_query);
|
|
/*
|
|
include "inc/record_update.php";
|
|
|
|
try {
|
|
// 設置一個空陣列來放資料
|
|
$data = array();
|
|
// sql語法存在變數中
|
|
$db_query = "SELECT * FROM expert WHERE id=$id";
|
|
|
|
// 用mysqli_query方法執行(sql語法)將結果存在變數中
|
|
$data = mysqli_query($link,$db_query);
|
|
}catch (Exception $e) {
|
|
echo 'Caught exception: ', $e->getMessage(), "\n";
|
|
}
|
|
*/
|
|
foreach($data as $data) :
|
|
?>
|
|
|
|
<div class="container">
|
|
<form class="form-inline" method="post" action="equipment-record-update.php" enctype="multipart/form-data">
|
|
<input type="hidden" name="id" value="<?php echo $id; ?>">
|
|
|
|
<div>
|
|
<label for="category">類別</label>
|
|
<input type="text" name="category" id="category" value="<?php echo $data['category']; ?>">
|
|
</div>
|
|
|
|
<div>
|
|
<label for="equipment_id">部品號</label>
|
|
<input type="text" name="equipment_id" id="equipment_id" value="<?php echo $data['equipment_id']; ?>">
|
|
</div>
|
|
|
|
<div>
|
|
<label for="equipment_name">部品名稱</label>
|
|
<input type="text" name="equipment_name" id="equipment_name" value="<?php echo $data['equipment_name']; ?>">
|
|
</div>
|
|
|
|
<div>
|
|
<label for="brand">廠牌</label>
|
|
<input type="text" name="brand" id="brand" value="<?php echo $data['brand']; ?>">
|
|
</div>
|
|
|
|
<div>
|
|
<label for="spec">規格</label>
|
|
<input type="text" name="spec" id="spec" value="<?php echo $data['spec']; ?>">
|
|
</div>
|
|
|
|
<div>
|
|
<label for="count_type">計量單位</label>
|
|
<input type="text" name="count_type" id="count_type" value="<?php echo $data['count_type']; ?>">
|
|
</div>
|
|
|
|
<div>
|
|
<label for="inventory">庫存數</label>
|
|
<input type="text" name="inventory" id="inventory" value="<?php echo $data['inventory']; ?>" onkeyup="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')" required>
|
|
</div>
|
|
|
|
<div>
|
|
<label for="list_price">牌價</label>
|
|
<input type="text" name="list_price" id="list_price" value="<?php echo $data['list_price']; ?>" onkeyup="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')" required>
|
|
</div>
|
|
|
|
<div>
|
|
<label for="discount">折扣</label>
|
|
<input type="text" name="discount" id="discount" value="<?php echo $data['discount']; ?>" onkeyup="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')" required>
|
|
</div>
|
|
|
|
<div>
|
|
<label for="final_price">最後售價</label>
|
|
<input type="text" name="final_price" id="final_price" value="<?php echo $data['final_price']; ?>" onkeyup="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')" required>
|
|
</div>
|
|
|
|
<div>
|
|
<label for="creater">建檔人</label>
|
|
<input type="text" name="creater" id="creater" value="<?php echo $data['creater']; ?>" readonly>
|
|
</div>
|
|
|
|
|
|
<div class="bottom-margin">
|
|
<label for="create_at">圖片</label>
|
|
<a><?php echo $data['picture']; ?></a>
|
|
<img width="125px" src="<?php echo $data['picture']?>" alt="" class="index-image">
|
|
</div>
|
|
<div class="bottom-margin">
|
|
<input type="file" name="fileToUpload" id="fileToUpload">
|
|
</div>
|
|
|
|
<div>
|
|
<button type="submit" name="update">確定</button>
|
|
</div>
|
|
<input type="hidden" name="token" value="<?php echo $token; ?>">
|
|
</form>
|
|
</div>
|
|
|
|
<?php
|
|
|
|
endforeach;
|
|
|
|
include "footer.php";
|
|
|
|
?>
|
|
|
|
|