RE: [PHP-WIN] Windows2000 OS - PHP 4.x - Warning: Undefined varia ble:
| From: | Benjamin Hardy | Date: | Sat, 11 Nov 2000 01:03:22 +0000 |
| Subject: | RE: [PHP-WIN] Windows2000 OS - PHP 4.x - Warning: Undefined varia ble: | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-3793@lists.php.net to get a copy of this message | ||
Try changing your line to:
$strSearchValue = trim( isset($SearchValue) ? $SearchValue : "" );
if SearchValue is not set, then the empty string will be trimmed,
giving an empty string :-)
alternately,
$SearchValue = isset($SearchValue) ? $SearchValue : ""
$strSearchValue = trim( $SearchValue );
or even
$strSearchValue = isset($SearchValue) ? trim( $SearchValue ) : "";
cheers
ben
-----Original Message-----
From: Vasu [mailto:gokaraju@hotmail.com]
Sent: Friday, November 10, 2000 16:51
To: php-windows@lists.php.net
Subject: [PHP-WIN] Windows2000 OS - PHP 4.x - Warning: Undefined
variable:
I developed a PHP program on Linux 6.2 OS and tested on Windows 2000 OS. It
gives "Undefined variable:" error message for the variables that are not
declared before.
For example,
the line of code that I am getting error at is :
$strSearchValue = trim($SearchValue);
and the error message is:
Warning: Undefined variable: SearchValue in
D:\MDLines\admin\department\DepartmentIndex.php on line 57
The variable $SearchValue is the name of a text box of HTTP Form. If there
is a value in the text box before the form is submitted, no error occurs.
Problem is only when the element is empty before the form is submitted.
This program works fine on Linux OS but not on Windows 2000 OS. I have PHP
4.x installed on both the operating systems. I am not sure whether I can
use PHP 4.x on Windows2000 OS but it seems okay other than this problem.
Please send your suggestions and appreciate your help.
Vasu