I have a problem which I hope I can describe right here. First of all let me say that I am an ASP developer learning PHP, so the solutions I come up with are usually ASP-solutions I want to code in PHP...
The problem is, I have a form with checkboxes:
<input type="checkbox" name="all" <? if($all!=""){echo"CHECKED";}?>>
<input type="checkbox" name="name" <? if($name!="" || $alles!=""){echo"CHECKED";}?>>
etc. etc.
Now, what I want is that when I visit the page for the first time, the all-checkbox is checked and therefore used in the query that follows this code. Therefore I have to set the all-variable the first time someone enters the page (let's say I set it to "on").
Now when I am on the page and I decide to uncheck the box, I don't want the all-checkbox to be used in the query after I post the form.
My problem is that if I print the all-variable on the first line of the page, the first time I enter the page, the variable is on. But since variables are global in PHP, it stays on, so even if I uncheck the box, it stays on after posting the form.
To avoid using global variables, I used
if($HTTP_POST_VARS["all"] !="on"){
$all="";
}
but this does not seem to work. :o
Now in ASP I would use request.form("all") and that always works... does $HTTP_POST_VARS work in the same manner?
Joyce