$filter = $HTTP_POST_VARS['att'];
$result = mysql_query("SELECT * FROM postingbob WHERE category ='{$filter}' ")or die(mysql_error());

That's my php code which basically takes values from 'att' in my html form

<div class="vx_two" style="float:right">
<select id="two" title="Select a category" class="pinkselect" name="att">
<option value="Addictions">Sort By Category</option>
<option value="Addictions">Default</option>

<option value="Addictions">Addictions</option>
<option value="Animals">Animals</option>
<option value="Arts">Arts</option>
<option value="Autos">Autos</option>
<option value="Beauty">Beauty</option>
<option value="Community">Community</option>
<option value="Confessions">Confessions</option>
<option value="Education">Education</option>
<option value="Food &amp; Drink">Food &amp; Drink</option>
<option value="Funny">Funny</option>
<option value="Games">Games</option>
<option value="Hate">Hate</option>
<option value="Health">Health</option>
<option value="Hobbies">Hobbies</option>
<option value="Holidays">Holidays</option>
<option value="Internet">Internet</option>
<option value="Legal Information">Legal Information</option>
<option value="Lifestyle">Lifestyle</option>
<option value="Movies">Movies</option>
<option value="Music">Music</option>
<option value="Office">Office</option>
<option value="Parenting">Parenting</option>
<option value="Pregnancy">Pregnancy</option>
<option value="Petitions">Petitions</option>
<option value="Relationships">Relationships</option>
<option value="Religion">Religion</option>
<option value="Science">Science</option>
<option value="Sex">Sex</option>
<option value="Sports">Sports</option>
<option value="Travel">Travel</option>




It does not show any results when i click the options from the drop down menu.I have a code to display it.(works when i dnt have the drop down in place), Don't think it's the 3 'addiction' options that cause it not to show.


$filter = $_REQUEST['att'];

Tried it but didnt work . I dnt have a submit button, all i have is the select tag and i just want the page to load whatever option is selected from the db.? is it my sql query?

Member Avatar


Is the select widget within a form tag with the method set to "post"?
Also don't use $_REQUEST or $HTTP_POST_VARS - use $_POST - it's safer.

BTW - why do you need 'default'?

<option value="addictions" selected="selected">Addictions</option>

should suffice

Neither is working at the moment. When I hover my mouse over the select it, it adds "#" after my url . I want it such that when an category is selected from the drop down it performs an sql query that queries the db to return the all articles in that category from the db. Is it cos i dont have a method="post" and action="phpself" or something? how should i submit the form? php self? Will it make a difference


Member Avatar


If you don't have a method/action how is the form supposed to be sent? Unless by js, and I assume you're not using that.

<form method="post" action="<?php echo $_SERVER['PHP_SELF'];?>">

(place your select widget in here)

<input type="submit" name="submitme" id="submitme" value="Send" />

You can run the select widget to submit the form via js - so you could do without the submit button, but this is frwoned upon w.r.t. accessibility - but you could place a <noscript> tag around the submit button to ensure that if js off, the form would still work.

Yes, the method is set to post but dont know what to set the action=" " to
I need the default so that when it is selected it takes the user to the mainpage(where they were before they selected which category they want.)

u dont need to use the brackets around the variable in the mysql statement only the ' and '