Why don't you just use $_REQUEST['keyword'] ?

On Sat, 4 Jan 2003, Michael J. Pawlowsky wrote:

> Well I've been fixing up all my code (and other peoples which is worst) getting 
>ready to do an upgrade to 4.3. and turning off globals and warnings on.
>
> I very often move parameters that were once POSTed as a GETs.
> For instance... some one does a search but is not logged in, they can see the 
>results but don's see the "Edit" results button.
> So they log in, and I send them back to the search they just did.
>
> The first search is done by a POST and when I redirect them after the login it's 
>done by a GET.
>
> So I use to simply not specify if it was a GET or POST and looked to see if the var 
>existed or not to see how to load that page.
>
> Now I've been adding alot of:
>
>
>         if (isset($_POST['keyword'])){
>             $keyword = $_POST['keyword'];
>         }elseif (isset($_GET['keyword'])){
>             $keyword = $_GET['keyword'];
>         } else {
>             unset($keyword);
>         }
>
>
> I suppose I could also do something like this (which is not much different)
>
>      if(isset($_POST['keyword']) || isset($_GET['keyword'])){
>         $keyword = isset($_POST['keyword'])?$_POST['keyword']:$_GET['keyword'];
>      }else{
>        unset($keyword);
>      }
>
> I guess I could get rid of the unset, but I like it there just in case something 
>earlier filled that puppy.
>
> So I end up with alot of these right now at the top of each page.
> Especially if the URI is something like 
>http:www.mysite.com/index.php?this=that&id=1&lang=en&so=on&so=on&so=on&so=on&so=on&so=on
>
> Know what I mean?
>
> So just wondering if anyine had something really elegant to replace it.
>
>
> Cheers,
> Mike
>
>

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

Reply via email to