Re[2]: [PHP] Submit Image Button
| From: | Timo Boettcher | Date: | Fri, 04 Apr 2003 11:13:58 +0000 |
| Subject: | Re[2]: [PHP] Submit Image Button | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-142293@lists.php.net to get a copy of this message | ||
Hi -{,
Nachricht vom Donnerstag, 3. April 2003, 16:27:56:
> If(!$_GET['sub_x'] && !$_GET['sub_y']) {
> // display form
> } else {
> // it was submitted
Use "isset" to test the variables... it is cleaner code. PHP will
complain if you do not. (Except of course if you silence it and turn
warnings of.) I have started to to to develop with
error_reporting(E_ALL);
set. This way, PHP complains about every unclean bit in code, like
reading from unset variables. Makes you write cleaner/less bug-prone
code.
If ((!isset($_GET['sub_x'])) and (!isset($_GET['sub_y']))) {
// display form
} else {
// it was submitted
}
BTW, in my experience it is enough to check one of these values with
isset, even if this one is 0, it will be SET to 0. You wont catch a
click at the coordinates x=0/y=0 with your code (don't know if that is
even possible, will have to read the specs...)
Timo