I am compiling a script that pulls out several $ _GET variables, which are then used in the script for the purpose of calculating quotes, etc.
The nightmare I have is simply to determine if there is any of them without a value, for example: var1 = 500 & var2 = & var3 = Yes, where var2 is a consequence of this.
Depending on whether or not all $ _GET variables have or not, I will take different actions accordingly.
I researched and came up with this as an option:
<?php foreach($_GET as $name => $value) { if ($value == "") { $proceed = 0; } else { $proceed = 1; } } ?>
I'm typing plain text using $ continue at the moment for testing purposes only.
This does not work, and I considered isset and empty , but I believe that both options are useless in this case. I read in several sources that the $ _GET parameters, which are not set to default values, are "therefore puzzled by why this does not work.
I cannot use empty here because sometimes the parameters will be set to 0.
It goes without saying that I printed the contents of $ _GET and got satisfactory results, so the data is fine.
Any help is greatly appreciated.
source share