$lname = ''; $username = ''; $password = ''; $card_id = ''; $nation_id = ''; $tel = ''; $sex = ''; $age = 0; $email = ''; $address = ''; $updatedate = ''; $picture = PICTURE_DEFAULT; $type = empty($_GET['user_type']) ? '' : $_GET['user_type']; $code = $pdo->createUserSerialCode($type); if (empty($code)) { $code = getDataList($type, listUserPrefixStatus()) . '00001'; } $validatePicture = 'required data-bv-notempty-message="กรุณาเลือกภาพส่วนตัว"'; /* * ตรวจสอบ id เพื่อดูว่ากำลังแก้ไขหรือสร้างใหม่ด้วย ฟังชั่น empty() = ว่าง , !empty = ไม่ว่าง */ if (!empty($_GET['id'])) { $stmt = $pdo->conn->prepare('SELECT * FROM user WHERE user_id =:id'); $stmt->execute(array(':id' => $_GET['id'])); $result = $stmt->fetch(PDO::FETCH_OBJ); /* * เซตค่าใส่ตัวแปร */ $id = $result->user_id; $code = $result->code; $fname = $result->fname;
?> px;"/></td> <td><?php echo $value->fname . ' ' . $value->lname; ?> </td> <td><?php echo $value->tel; ?> </td> <td><?php echo $value->email; ?> </td> <td><?php echo getDataList($value->type, listUserStatus()); ?> </td> <td style="width: 8%;"> <a href="index.php?user_type=<?php echo $user_type; ?> &page=form-user&id=<?php echo $value->user_id; ?> " class="btn btn-success"> <i class="glyphicon glyphicon-pencil"></i>แก้ไข </a> </td> <td style="width: 8%;"> <button type="button" class="btn btn-danger" onclick="delete_data(<?php