Advertisement
Guest User

Untitled

a guest
Mar 28th, 2015
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. function getCategories($id = null) {
  2. $categoried = array();
  3.  
  4. $query = mysql_query("SELECT id,name FROM `categories`");
  5.  
  6. while ($row = mysql_fetch_assoc($query) ) {
  7. $categories [] = $row;
  8. }
  9.  
  10. ...
  11. <select name="category">
  12. <?php
  13. foreach(getCategories() as $category){
  14. ?>
  15. <option value=" <?php echo $category['id'];?> " > <?php echo $category['name'];?> </option>
  16. <?php
  17. }
  18. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement