Solved

php - processing checkboxes

Posted on 2014-04-15
3
313 Views
Last Modified: 2014-04-15
Hello,

I have a php program (attached) designed to process checkboxes on a form. Note the echo was to debug & find out why it wasn't working.

Also attached is the HTML page, as it existed upon calling the php program.

Note in the html program, there are several checkbox elements that are NOT checked. Those elements are NOT being picked up in the php program which defeats the whole purpose.

Why are the unchecked elements NOT being picked up?
updt-base-citylinks.php
manage-base-citylinks.htm
0
Comment
Question by:Richard Korts
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 110

Accepted Solution

by:
Ray Paseur earned 500 total points
ID: 40002869
Unchecked checkboxes are not present in the request variables.  They are not "there and empty;" they are simply missing.  This is the way that it works.  Dumb design, but an unfortunate fact of life.  Please read this over and see if it helps with the understanding.
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/A_5450-Common-Sense-Examples-Using-Checkboxes-with-HTML-JavaScript-and-PHP.html
0
 

Author Comment

by:Richard Korts
ID: 40002890
I thought that MIGHT be the case, but I thought THAT was a stupid idea to even consider

I can envision a workaround.

Thanks
0
 
LVL 110

Expert Comment

by:Ray Paseur
ID: 40002897
The workaround might be an input of an identical name attribute with type="hidden" as described in the article.  I have used that successfully.  It's a PHP-only solution because some languages that use raw post input require specialized programming to deal with the request data.  But if you're using PHP and you use the $_GET or $_POST arrays, you'll be on firm ground.

Thanks for the points, ~Ray
0

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

732 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question