IF ELSE problem on PHP4/WIN2K

From: Date: Fri, 10 Aug 2001 04:44:39 +0000
Subject: IF ELSE problem on PHP4/WIN2K
Groups: php.windows 
Request: Send a blank email to php-windows+get-8745@lists.php.net to get a copy of this message
All: My problem is probably a simple coding issue, but I can't figure it out. This is with PHP 4.0.6 on Win2K with IIS5. I have a html form (using checkboxes) gathering some data, and I pass it onto a PHP file. When the user checks the checkbox, everything works properly. Here is a sample of the html (it is standard): <input type="checkbox" name="CategoriesONE" value="ONE"> Type: One<br> <input type="checkbox" name="CategoriesTWO" value="TWO"> Type: Two<br> Now, in my PHP I have the following routine: <? if ( $CategoriesONE != "" ) echo "ONE "; if ( $CategoriesTWO != "" ) echo "TWO "; ?> If you check the box, the resultant PHP file generates an html page with the word ONE and/or TWO like it should. BUT, if you leave either or both of the checkboxes empty (don't check them) I get the following error: Warning: Undefined variable: CategoriesONE in C:\inetpub\wwwroot\PrintUserForm.php on line 71 Warning: Undefined variable: CategoriesTWO in C:\inetpub\wwwroot\PrintUserForm.php on line 73 I tried adding an ELSE statement after each IF clause, to no avail. I also tried changing the != "" to == "ONE" (and == "TWO" for the other), but that didn't work either. Has anyone heard of some problem between PHP on WIN2K running IIS5? The reason I say this is that I also have another 2K box with Apache, and on that one these 2 pages work perfectly.. Unfortunately, I have to get it running on IIS. Any help/insight will be appreciated. Thanks! Joseph Moore

« previous php.windows (#8745) next »