Heya Guys:
This thing always bothered me, so I'm asking to see if anyone can shed some light on how to work around this issue.
I have the following code:
<select name="category" id="category" class="input_text">
<option value="">Select a category</option>
<?php
while ($rows_cats = mysql_fetch_array($result_cats)):
$catID = $rows_cats['catID'];
$catName = $rows_cats['catName'];
?>
<option value="<?php echo $catID; ?>"><? echo $catName; ?></option>
<?php endwhile; ?>
</select>
Now, that goes into a drop down menu that shows the categories. However, I have several drop down menus (a person can select three categories). However, when I try to do another while with the same code, it doesn't fetch the results.
MEANING: If I add another one of these:
<select name="category2" id="category2" class="input_text">
<option value="">Select a category</option>
<?php
while ($rows_cats = mysql_fetch_array($result_cats)):
$catID = $rows_cats['catID'];
$catName = $rows_cats['catName'];
?>
<option value="<?php echo $catID; ?>"><? echo $catName; ?></option>
<?php endwhile; ?>
</select>
It wont show up the values of the $catID and $catName variables
I dont want to query the database twice or three times when I already have the information I need. How do I do this? Am I doing it wrong?
What do you guys recommend I do?