Re: [apdance9] Category Search box with dropdown
Hi April,
The problem is in your drop down box. For each of your <option> tags, you are only providing a label, not a value, so you're always providing an empty search to the page.
How to fix this depends on how your storing the article category in the article table (ie, are you using the category name, or the category number?).
Here's the code you should try to add for either instance (the changes have been highlighted in red):
If you store the category using the categories name:
<span class="bodytext">Search by Category:</span><br /><br />
<form method="post" action="../search/articlesearch.php" >
<select name="article_category">
<option value="">select</option>
<?php foreach ($article_categoryRecords as $record): ?>
<option value="<?php echo $record['name'];?>"><?php echo $record['name'] ?></option>
<?php endforeach ?>
</select>
If you store the article as a number:
<span class="bodytext">Search by Category:</span><br /><br />
<form method="post" action="../search/articlesearch.php" >
<select name="article_category">
<option value="">select</option>
<?php foreach ($article_categoryRecords as $record): ?>
<option value="<?php echo $record['num'];?>"><?php echo $record['name'] ?></option>
<?php endforeach ?>
</select>
Give that a try and let me know how that goes.
Hope this helps.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/