Re: Need to set default parameter || How to do in PHP?
| From: | Noah | Date: | Sun, 02 Feb 2003 00:46:28 +0000 |
| Subject: | Re: Need to set default parameter || How to do in PHP? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-133921@lists.php.net to get a copy of this message | ||
Nice Phil.
A little more typing than the CF version, but the more I delve into PHP, the
more I realize its power and flexibility.
Thanks for the speedy reply...........
--Noah
----- Original Message -----
From: "Philip Olson" <philip@cornado.com>
To: "CF High" <noah@newminddesign.com>
Cc: <php-general@lists.php.net>
Sent: Saturday, February 01, 2003 1:05 PM
Subject: Re: [PHP] Need to set default parameter || How to do in PHP?
> On Sat, 1 Feb 2003, CF High wrote:
>
> > Hey all.
> >
> > In cold fusion I was able to define a default value with the <cfparam
name =
> > "test" default = "myValue"> tag
> >
> > When I passed the variable "test" via a form or query string, it would
over
> > ride the parameter value.
> >
> > How can I do this in PHP? I looked in PHP manual for param, default,
etc.,
> > but could find no equivalent.
> >
> > Any ideas?
>
> if (!isset($_REQUEST['rvar']) || inappropriate($_REQUEST['rvar'])) {
> $rvar = 'default';
> } else {
> $rvar = $_REQUEST['rvar'];
> }
>