<form method="post" action="searchtest.php" accept-charset="utf-8"> <input type="hidden" name="submitted" value="true"> <label> Search Category : <select name="category" > <option value="firstname">firstname</option> <option value="surname">surname</option> <option value="address">address</option> <option value="tel">tel</option> <option value="email">email</option> <option value="gender">gender</option> </select> </label> <label>Search : <input type="text" name="search"></label> <input type="submit" name=""> </form> <?php if (isset($_POST['submitted'])) { include('connectdb.php'); $category = $_POST['category']; $search = $_POST['search']; $query = "SELECT * FROM users WHERE $category LIKE '%".$search."%'"; $result = mysqli_query($conn, $query) or die ('error'); $user_data = array(); $num_rows = mysqli_num_rows($result); echo "$num_rows result found"; echo "<table>"; echo "<tr><th>firstname</th><th>surname</th><th>address</th><th>tel</th><th>email</th><th style='text-align:right'>gender</th></tr>"; while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)){ echo"<tr><td>"; echo $row['firstname']; echo "</td><td>"; echo $row['surname']; echo "</td><td>"; echo $row['address']; echo "</td><td>"; echo $row['tel']; echo "</td><td>"; echo $row['email']; echo "</td><td style='text-align:right'>"; echo $row['gender']; echo "</td></tr>"; $user_data[] = array( 'firstname' => $row["firstname"], 'surname' => $row["surname"], 'address' => $row["address"], 'tel' => $row["tel"], 'email' => $row["email"], 'gender' => $row["gender"] ); } echo "</table>"; } ?>
$json_result = json_encode( $record_result);
<input type="hidden">
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง