$id = ''; $fname = ''; $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;