Jump to content

Recommended Posts

I would like to have a mechanism that I can show records by using a pull down menu. I created this script (and probably there a lot of mistakes in it and therefore I need the help from you):

$query="SELECT answer_date, category, countryb, question, answer FROM faqhcch WHERE $zoekcat LIKE 'categoryb' ORDER BY answer_date DESC LIMIT 0,7";
$result=mysql_query($query);

$num=mysql_num_rows($result);

mysql_close();

?>


<form name="form1" method="post" action="<? echo $PHP_SELF; ?>">
<select name="zoekcat">
<option>Select Member State</option>
<option>Albania</option>
<option>Argentina</option>
<option>Australia</option>
<option>Austria</option>
<option>Belarus</option>
<option>Belgium</option>
<option>Bosnia and Herzegovina</option>
<option>Brazil</option>
<option>Bulgaria</option>
<option>Canada</option>
<option>Chile</option>
<option>China, Peoples Republic of</option>
<option>Croatia</option>
<option>Cyprus</option>
<option>Czech Republic</option>
<option>Denmark</option>
<option>Egypt</option>
<option>Estonia</option>
<option>Finland</option>
<option>France</option>
<option>Georgia</option>
<option>Germany</option>
<option>Greece</option>
<option>Hungary</option>
<option>Iceland</option>
<option>Ireland</option>
<option>Israel</option>
<option>Italy</option>
<option>Japan</option>
<option>Jordan</option>
<option>Korea, Republic of</option>
<option>Latvia</option>
<option>Lithuania</option>
<option>Luxembourg</option>
<option>Malaysia</option>
<option>Malta</option>
<option>Mexico</option>
<option>Monaco</option>
<option>Morocco</option>
<option>Netherlands</option>
<option>New Zealand</option>
<option>Norway</option>
<option>Panama</option>
<option>Paraguay</option>
<option>Peru</option>
<option>Poland</option>
<option>Portugal</option>
<option>Romania</option>
<option>Russian Federation</option>
<option>Serbia and Montenegro</option>
<option>Slovakia</option>
<option>Slovenia</option>
<option>South Africa</option>
<option>Spain</option>
<option>Sri Lanka</option>
<option>Suriname</option>
<option>Sweden</option>
<option>Switzerland</option>
<option>The former Yugoslav Republic of Macedonia</option>
<option>Turkey</option>
<option>Ukraine</option>
<option>United Kingdom of Great Britain and Northern Ireland</option>
<option>United States of America</option>
<option>Uruguay</option>
<option>Venezuela</option>
</select>
</form>
<hr>
<?
$i=0;
while ($i < $num) {
$answerdate=mysql_result($result,$i,"answer_date");
$category=mysql_result($result,$i,"category");
$countryb=mysql_result($result,$i,"countryb");
$question=mysql_result($result,$i,"question");
$answer=mysql_result($result,$i,"answer");
?>

<table width='97%' border='0'>
<tr bgcolor="#330066">
<td width="14%"><font color="#FFFFFF">&nbsp;</font></td>
<td width="86%"><strong><font color="#FFFFFF" size='2' face='Arial, Helvetica, sans-serif'><? echo $countryb; ?></font></strong></td>
</tr>
<tr>
<td bgcolor="#00CCCC"><div align='right'></div>
<div align='right'></div></td>
<td><font size='3' face='Arial, Helvetica, sans-serif'><b>&nbsp;<? echo $category; ?></b></font></td>
</tr>
<tr>
<td bgcolor="#00CCCC"><div align="right"><font size="2" face="Arial, Helvetica, sans-serif"><em><strong>QUESTION:</strong></em></font></div></td>
<td><font size='2' face='Arial, Helvetica, sans-serif'><? echo $question; ?>
</font></td>
</tr>
<tr>
<td bgcolor="#00CCCC"><div align='right'><em><font size='2' face='Arial, Helvetica, sans-serif'><strong>ANSWER:</strong></font></em></div></td>
<td><font size='2' face='Arial, Helvetica, sans-serif'><? echo $answer; ?></font></td>
</tr>
<tr>
<td bgcolor="#00CCCC"><div align='right'><em><font size='2' face='Arial, Helvetica, sans-serif'><strong>Date:</strong></font></em></div></td>
<td><font size='2' face='Arial, Helvetica, sans-serif'><? echo $answer_date; ?></font></td>
</tr>
</table>
<hr>
<?
++$i;
}
echo "</table>";


?>

</body>
</html>
Link to comment
https://forums.phpfreaks.com/topic/10893-searching-with-pull-down-menu/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.