daily pastebin goal
50%
SHARE
TWEET

Untitled

a guest Aug 20th, 2018 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Echoing row name where posted ID, for pre-selected form value
  2. <select name="search_category"  id="select1" >
  3. <option value="">By Category</option>
  4.  <?php if (!empty($_POST['search_category'])) { ?>
  5.  <option value="<?php echo $_POST['search_category']; ?>" selected="selected"><?php echo $_POST['search_category']; ?></option>
  6. <?php }?>
  7.   <?php foreach($categoriesListt as $row) : ?>
  8.  
  9.   <option value="<?php echo $row->id; ?>"><?php echo $row->name; ?></option>
  10.  
  11.                                       <?php endforeach; ?>
  12.                                 </select>
  13.    
  14. <?php echo $row->name;  WHERE ID = $_POST['search_category']
  15.    
  16. <?php
  17.  
  18.     function($id, $table) {
  19.  
  20.         select ... etc
  21.  
  22.     }
  23. ?>
  24.    
  25. SELCET('id', 'name' FROM yourTable WHERE 'name' = $_POST['ID'])
  26.    
  27. <?php foreach($categoriesListt as $row) : ?>
  28.     <option value="<?php echo $row->id; ?>"
  29.           <?php if($row->name == $_POST['search_category']) : ?>
  30.                selected="selected"<?php } ?>>
  31.         <?php echo $row->name; ?>
  32.     </option>
  33. <?php endforeach; ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top