[PHP] isset bug?
Ok, here's the deal. I like to use $_GET and $_POST variables without values to notify my scripts that some action must be taken. For example, given the following URL: http://blahdomain/blah.php?productid=1edit or given the following form element: input type=hidden name=edit My blah.php script will check if edit set using the following line: if (isset($_REQUEST[edit])) { .. } and then it will take the appropriate actions (lets just say its updating a record in the database). Locally I am running PHPv4.3.2, and everything works fine. I have been working on a large web-based application for the last month, and yesterday I put it up live. Our host unfortunately runs PHPv4.2.1 and I have no access to the conf files (those bastards) and globals are set to on. Low and behold, the isset function returns false when a $_POST or $_GET variable is passed but contains no value, which would be exactly the same thing as checking the variable itself: if ($_REQUEST[edit]) { } What I want and needed to do was check for the existance of the variable, not whether it has a value. So is this a bug, a feature or just some random happening? Thank guys PHP ROCKS -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] isset bug?
* Thus wrote Christian Calloway ([EMAIL PROTECTED]): Ok, here's the deal. I like to use $_GET and $_POST variables without values to notify my scripts that some action must be taken. For example, given the following URL: http://blahdomain/blah.php?productid=1edit or given the following form element: input type=hidden name=edit simply add a value=1 and it will fix your problem. My blah.php script will check if edit set using the following line: if (isset($_REQUEST[edit])) { .. } and then it will take the appropriate actions (lets just say its updating a record in the database). Locally I am running PHPv4.3.2, and everything works fine. I have been working on a large web-based application for the last month, and yesterday I put it up live. Our host unfortunately runs PHPv4.2.1 and I have no access to the conf files (those bastards) and globals are set to on. Low and behold, the isset function returns false when a $_POST or $_GET variable is passed but contains no value, which would be exactly the same thing as checking the variable itself: Curt -- I used to think I was indecisive, but now I'm not so sure. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] isset bug?
What I was trying to avoid is exactly that. It would require changing links and hidden fields throughout the entire application, which would take hours to track down. I am looking for a nice lazy and easy fix. Curt Zirzow [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] * Thus wrote Christian Calloway ([EMAIL PROTECTED]): Ok, here's the deal. I like to use $_GET and $_POST variables without values to notify my scripts that some action must be taken. For example, given the following URL: http://blahdomain/blah.php?productid=1edit or given the following form element: input type=hidden name=edit simply add a value=1 and it will fix your problem. My blah.php script will check if edit set using the following line: if (isset($_REQUEST[edit])) { .. } and then it will take the appropriate actions (lets just say its updating a record in the database). Locally I am running PHPv4.3.2, and everything works fine. I have been working on a large web-based application for the last month, and yesterday I put it up live. Our host unfortunately runs PHPv4.2.1 and I have no access to the conf files (those bastards) and globals are set to on. Low and behold, the isset function returns false when a $_POST or $_GET variable is passed but contains no value, which would be exactly the same thing as checking the variable itself: Curt -- I used to think I was indecisive, but now I'm not so sure. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] isset bug?
This should help: http://www.php.net/manual/en/function.array-key-exists.php Cheers, Rob. On Fri, 2003-08-22 at 13:26, Curt Zirzow wrote: * Thus wrote Christian Calloway ([EMAIL PROTECTED]): Ok, here's the deal. I like to use $_GET and $_POST variables without values to notify my scripts that some action must be taken. For example, given the following URL: http://blahdomain/blah.php?productid=1edit or given the following form element: input type=hidden name=edit simply add a value=1 and it will fix your problem. My blah.php script will check if edit set using the following line: if (isset($_REQUEST[edit])) { .. } and then it will take the appropriate actions (lets just say its updating a record in the database). Locally I am running PHPv4.3.2, and everything works fine. I have been working on a large web-based application for the last month, and yesterday I put it up live. Our host unfortunately runs PHPv4.2.1 and I have no access to the conf files (those bastards) and globals are set to on. Low and behold, the isset function returns false when a $_POST or $_GET variable is passed but contains no value, which would be exactly the same thing as checking the variable itself: Curt -- I used to think I was indecisive, but now I'm not so sure. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- .-. | Worlds of Carnage - http://www.wocmud.org | :-: | Come visit a world of myth and legend where | | fantastical creatures come to life and the | | stuff of nightmares grasp for your soul.| `-' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php