Re: $POST Q

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, December 12, 2006 2:14 am, William Stokes wrote:
> Can someone tell me what wrong or to how to manage this?
>
> //default
> $limitorig = 10;
>
> echo "<select name=\"USRlimitorig\">";
> echo "<option selected value=>$limitorig</option>";
> echo "<option>10</option>";
> echo "<option>20</option>";
> echo "<option>30</option>";
> echo <input type=\"submit\" name=\"resetlimit\" value=\"GO\">";

<?php
  $limit = isset($_REQUEST['limit']) ? $_REQUEST['limit'] : 10;
  $limit = (int) $limit; //crude filtering of input, but effective
?>
<select name="USERlimitorig">
<?php
  for ($l = 10; $l <= 30; $l += 10){
    $selected = $l == $limit ? 'selected="selected"' : '';
    echo "<option value=\"$l\" $selected>$l</option>\n";
  }
?>
</select>
<input type="submit" name="resetlimit" value="GO" />

The value="x" *is* optional, but you'll never convince the people who
tell you it isn't, unless you force them to read the RFCs and W3C
recommendations [*], so it's easier to include it than to argue with
them. :-)

YMMV
NAIAA

* W3C may have changed their minds on this since last week when we
visited their site after this same topic came up in this very forum...
But I doubt it.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux