Re: How to define varibles
| From: | Ignacio Vazquez-Abrams | Date: | Sat, 25 Nov 2000 23:05:51 +0000 |
| Subject: | Re: How to define varibles | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-27193@lists.php.net to get a copy of this message | ||
On Sat, 25 Nov 2000, jcrowe wrote:
> I am new at php ('bout 2 days now) I have made a page that submits a form to
> itself but I am getting the following warnings.
>
> Warning: Undefined variable:
>
> I know that this is caused by the error settings in php.ini and I have
> changed it on my local machine but the hosting company has not changed this
> setting on there boxes.
>
> My question is Can I work around this somehow? Is there a way to Define the
> Varibles?
> I know that in cold fusion you can set a varible to NULL if it doesn't have
> a value. anything similar in php?
>
> Thanks,
> Jason
>
Three things:
1) Use error_reporting() to exclude warnings. (Bad Idea)
2) Assign false to the variable first. (Not Quite As Bad An Idea)
3) Use isset() to detect whether or not a variable exists before reading from
it. (What I Do)
--
Ignacio Vazquez-Abrams <ignacio@openservices.net>