- create content
- events
- links
- spanner blog
- recent posts
- view my page
- news aggregator
- categories
- sources
- AlwaysOn
- Due Dilgence - Tim Oren
- Engadget
- Linsec.ca Tech Blog
- LinuxDevices
- Open Source Initiative
- Origami Partners News
- Pierce Law IP News Blog
- Reuters - Politics
- Reuters - Technology
- Reuters - Top News
- Sarah Pullman
- Slashdot
- SourceForge New Releases
- The Mitchell Report
- Ubergizmo, The Gadgets Radar
- Wired News
- freshmeat.net
- i-Policy
GET, POST and those pesky CHECKBOXes
Chapter | Code
One of the most stultifying, heartburn-inducing stupidities in the HTML/HTTP/CGI specifications is the behavior of the input type="CHECKBOX" form element.
Unlike ANY other form element, the checkbox element name appears in the GET/POST stream ONLY if it has been checked. If it's unchecked it's not present at all, unless you add logic to your code to forcibly include "checkboxelemname=0" or somesuch in your POST.
To complete our calamitous kludge integrating JSP within a PHP framework, of course, we'll have to do just that. Since we saw earlier that we need to convert all POST data to GET so it can "reach" the JSP script processed by the PHP virtual function, the only way to preserve expected checkbox behavior is to keep the element present, set to '1' (or 'checked' or whatever you like) when it's checked, and to '0' (or 'unchecked' or even an empty string) when it's not.
