Problem with $_POST, if isset() and mysql_fetch_assoc(): echo returns correct value, page source always returns else value
This question started as a different thread, but after a lot of searching and narrowing down the problem it has changed quite significantly and as such I thought it may be relevant to start a new question an link back to the old one which is:
I don’t believe the description to be adequate anymore as the concatenation works fine.
It does seem that I am homing in on the problem. I have a simple form:
I then have a PHP function that checks if GFCheckbox is selected. If it is a certain string is passed to the $query value. If it isn’t a different string is passed to the $query value. Here is the PHP function.
When I select the checkbox, all the echo statements work perfectly and displays on screen all the records where GFOption = “1”. But when I view the page source ALL the records are echoed there. This is however specific to whatever I have in the else statement of the if condition. If the checkbox is checked or unchecked, whatever I have in the else statement executes and if there is output it gets printed to the page source.
Another interesting thing is that if I hard code my if conditional statement to
the statements work exactly the way they should, and no weird page source printing happens.
If I do
I get the correct boolean values depending on if GFCheckbox is checked or not.
As you can see I am running in circles with this and would really appreciate any help.
You appear to still be checking isset() even though the question isn’t whether it’s set, the question is whether it’s true or false. PHP munges a lot of things when you check variables as booleans but isset() on a set variable containing false will still return true.
and see what happens.