[PHP] RE: [newbie] drop down boxes

2003-04-06 Thread Bobby Rahman


Hiya,

I have created a dynamic table within my form.
Above the table I want to insert a filter to order by:the column names
Here is the static list:
select name=select4
   optionSeverity/option
   optionCrash/option
   optionMajor/option
   optionMinor/option
   optionReview/option
 /select
What I need suggestions on is:
1. recommended tutorials on lists and logic behind them.
2. How does the selected item in the list get stored (a variable?)and how 
can I place that in such a way to ORDER BY $filter_selected
3. also simple snippets of code always is appreciated (No one wants to 
reinvent the wheel) :)

Thanx

Bob

_
Use MSN Messenger to send music and pics to your friends 
http://www.msn.co.uk/messenger

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] RE: [newbie] drop down boxes

2003-04-06 Thread Philip Olson
On Sun, 6 Apr 2003, Bobby Rahman wrote:
 
 Hiya,
 
 I have created a dynamic table within my form.
 Above the table I want to insert a filter to order by:the column names
 
 Here is the static list:
 select name=select4
 optionSeverity/option
 optionCrash/option
 optionMajor/option
 optionMinor/option
 optionReview/option
   /select
 
 What I need suggestions on is:
 1. recommended tutorials on lists and logic behind them.
 2. How does the selected item in the list get stored (a variable?)and how 
 can I place that in such a way to ORDER BY $filter_selected
 3. also simple snippets of code always is appreciated (No one wants to 
 reinvent the wheel) :)

Checkbox, select, input text, textarea, who cares ... it
all comes out the same.  Read this:

  http://www.php.net/variables.external

The real question is is your form POST or GET, you will
find the answer within the above manual page on how to
retrieve the value.  Hint: $_POST['select4'];  Now let's
say you want to make sure it's appropriate first, and
then create the query, here's an example:

  $selects = array('severity','crash','major','minor','review');

  $select = strtolower($_POST['select4']);
  if (!in_array($select, $selects)) {
  $select = 'severity';
  }

  $sql = SELECT a FROM b ORDER BY $select LIMIT 40:

Of course that assumes those are table names in your db.  You
may want to be a little more user friendly and do for example:

  option value='severity'The Severity blah blah/option

Regards,
Philip


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php