dropbox not populating

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
angelic_devil
Forum Commoner
Posts: 74
Joined: Thu Apr 02, 2009 7:05 am

dropbox not populating

Post by angelic_devil »

plz help...the code below doesn't populate the dropbox with the records

Code: Select all



<?
// Initializes a list of acceptable category
$category_list = array();

$query_category = " SELECT categorylist.categoryname from categorylist ";

       $result_category = mysql_query($query_category);
        confirm_query($result_category);
        
      
        
        $category_list[]=" ";
  while ($record = mysql_fetch_assoc($result_category)) {
          $category_list[] = $record['categoryname'] ;
          echo '<option>'.['categoryname'].'</option>';
          
        }
$category = $_GET['categoryname'];
 
      
 
 ?>
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: dropbox not populating

Post by social_experiment »

Code: Select all

<?php
while ($record = mysql_fetch_assoc($result_category)) {
          $category_list[] = $record['categoryname'] ;
          echo '<option> '. $record['categoryname'] . '</option>';          
}
?>
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
angelic_devil
Forum Commoner
Posts: 74
Joined: Thu Apr 02, 2009 7:05 am

Re: dropbox not populating

Post by angelic_devil »

doesn't work

give the error

'. $record['categoryname'] . ''; } } //$category = $_GET['categoryname']; ?>
angelic_devil
Forum Commoner
Posts: 74
Joined: Thu Apr 02, 2009 7:05 am

Re: dropbox not populating

Post by angelic_devil »

OK i got it to work...little change in code
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: dropbox not populating

Post by social_experiment »

Out of curiosity, what error did you get?
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
User avatar
Jonah Bron
DevNet Master
Posts: 2764
Joined: Thu Mar 15, 2007 6:28 pm
Location: Redding, California

Re: dropbox not populating

Post by Jonah Bron »

@social_experiment: I'd say his (local)host had short tags disabled :)
Post Reply