Advertisement
Guest User

Untitled

a guest
Jan 16th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. <?php $specialties = $wpdb->get_results("SELECT * FROM specialties ORDER by name ASC"); ?>
  2. <select class="form-control" name="specialty">
  3. <?php foreach($specialties as $specialty){ ?>
  4. <option value="<?php echo $specialty->id; ?>"><?php echo $specialty->name; } ?></option>
  5. </select>
  6.  
  7. $s = esc_sql($_GET['specialty']);
  8.  
  9. $sql = "SELECT id, name
  10. FROM specialties
  11. WHERE";
  12. if(!empty($s)) {
  13. $sql .= " specialty LIKE '%$s%'";
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement