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.
82 lines
2.4 KiB
82 lines
2.4 KiB
<?php
|
|
#此段以下由系統自斷產生 include 'day_off-schema.php';
|
|
include "day_off-schema.php";
|
|
include "../header.php";
|
|
|
|
$id = isset($_GET['id']) ? $_GET['id'] : die('ERROR: Record ID not found.');
|
|
|
|
$data = array();
|
|
// sql語法存在變數中
|
|
$db_query = "SELECT * FROM $system_name 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="<?php echo $system_name; ?>-record-update.php" enctype="multipart/form-data">
|
|
<input type="hidden" name="id" value="<?php echo $id; ?>">
|
|
|
|
<?php for ($i = 1; $i < count($html_schema); ++$i) { ?>
|
|
<div>
|
|
<?php
|
|
$label = $html_schema[$i]["label"];
|
|
$element_type = $html_schema[$i]["type"];
|
|
$name_id = $html_schema[$i]["id"];
|
|
$placeholder = $html_schema[$i]["placeHolder"];
|
|
$others = $html_schema[$i]["others"];
|
|
|
|
# 產生Label
|
|
if (stripos($others, "required")){
|
|
echo "<label for='$name_id'>" . $label . "(必填)</label>";
|
|
}else{
|
|
echo "<label for='$name_id'>" . $label . "</label>";
|
|
};
|
|
|
|
# 產生輸入內容
|
|
switch ($element_type) {
|
|
case "text":
|
|
#echo "<input type='" . $html_schema[$i]["type"] . "' name='" . $html_schema[$i]["id"] . "' id='" $html_schema[$i]["id"] . "' placeholder='" . $html_schema[$i]["placeHolder"] . " " . $html_schema[$i]["others"] . ">";
|
|
echo "<input type='text' name='$name_id' id='$name_id' " . "value='" . $data[$name_id] . "'" . " $others>";
|
|
break;
|
|
default:
|
|
echo "<input type='text' name='$name_id' id='$name_id' " . "value='" . $data[$name_id] . "'" . " $others>";
|
|
break;
|
|
|
|
};
|
|
?>
|
|
</div>
|
|
<?php }; ?>
|
|
|
|
|
|
<div>
|
|
<br>
|
|
<button type="submit" name="update">確定</button>
|
|
</div>
|
|
<input type="hidden" name="token" value="<?php echo $token; ?>">
|
|
</form>
|
|
</div>
|
|
|
|
<?php
|
|
|
|
endforeach;
|
|
|
|
include "../footer.php";
|
|
|
|
?>
|
|
|