views:

55

answers:

2

Sometimes, when I submit a form that gathers checkbox data, the checkbox data displays perfectly and other times, the values don't display at all. Any ideas what could cause this?

A: 
  1. A typo in your code
  2. You misunderstand how checkboxes work
  3. Ineffective debugging logic
  4. Bad logic to begin with

Those would be the most likely causes. If you share some code and a more specific example I bet it can be narrowed down even further.

Syntax Error
A: 

You probably have a problem with your URL structure. You may be trying to post data to a URL thats different then your current location. This tends to look like a cross site scripting attack and the server won't be able to grab your posted variables in this case.

Example of what I'm talking about:

I have a form here: http://www.mywebsite.com/myform.php

Now I try to submit the form to: http://mywebsite.com/myform.php

To a user this seems fine but the server thinks that the www. version of the site is a different website and doesn't grab your variables.

For consistency you should always force a user to either the www. or non www. version of your website using a .htaccess file.

Hope that helps.