Jump to content

[SOLVED] how to use form for filtering ??


janim

Recommended Posts

hi every body

i wanna use simple filter like this  :


<form action="" method="post" >
<select name="select2">
      <option value="new">new</option>
      <option value="old">old</option>
    </select>   
</form>
<?
$filter="id desc";
$filter="id asc";
$filter="anything else";

$showing=mysql_db_query($bas,"select * from $movtab  order by $filter ) or die
?>

 

as you see i can't detect what is will change the $filter variable

so any suggestion please

Link to comment
Share on other sites

If you want the content that you're filtering to change as you pick new or old then you will need either ajax to change it in a container on the page or just reload the page with the settings that are selected. However, I also would need more details as to what you are trying to do..?

 

If you are planning to reload the page when the form is submitted then you could use $HTTP_POST_VARS or $_GET to grab the settings you select and sort the content. You could also set the default selected item in the select box by echoing the options out and adding (I think this is correct) "selected" inside the <option> tag.

Link to comment
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.