Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 983559
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T04:52:38+00:00 2026-05-16T04:52:38+00:00

For some reason my checkbox array values don’t show up in $_POST. For example:

  • 0

For some reason my checkbox array values don’t show up in $_POST.

For example:

<form method="post" action="">
    <input type="checkbox" name="cb[]" value="1">
    <input type="checkbox" name="cb[]" checked="checked" value="2">
    <input type="checkbox" name="cb[]" value="3">
    <input type="checkbox" name="cb[]" checked="checked" value="4">
    <input type="checkbox" name="cb[]" checked="checked" value="5">
    <input type="checkbox" name="cb[]" value="6">
    ...
    <input type="checkbox" name="cb[]" checked="checked" value="26">
    <input type="checkbox" name="cb[]" value="27">
    <input type="submit" value="insanitizer"/>
</form>

When submit:

<?php
print_r($_POST); //Because print_r($_POST['cb']); gives ''

Array (
   [category] =>
)

print_r($_REQUEST['cb']);  //Showing the correct array name was used

Array
(
    [0] => 2
    [1] => 4
    [2] => 5
    [3] => 26
)
?>

I’m happy that I can at least get the checkbox data here, but I’m left with one question:

Wtf?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T04:52:39+00:00Added an answer on May 16, 2026 at 4:52 am

    Dur dur dur…

    As part of general initialization I run $_POST and $_GET through:

    <?php
    if(sizeof($_POST) > 0){
        foreach($_POST as $key => $value){
            $_POST[$key] = $this->_db->realEscapeString($value);
        }
    }
    if(sizeof($_GET) > 0){
        foreach($_GET as $key => $value){
            $_GET[$key] = $this->_db->realEscapeString($value);
        }
    } 
    ?>
    

    Which seems to nuke any arrays…

    Replaced above with:

    <?php
    ...
    if(sizeof($_GET) > 0){
            $this->initDbCleanArray($_GET);
        }
    }
    ...
    
    private function initDbCleanArray($a)
    {
        if(sizeof($a) > 0){
            foreach($a as $key => $value){
                if(is_array($a[$key])){
                    $this->initDbCleanArray($a[$key]);
                }
                else{
                    $a[$key] = $this->_db->realEscapeString($value);
                }
            }
        }
    }
    ?>
    

    realEscapeString = mysql_real_escape_string

    …and $_POST[‘cb’] lives!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Having trouble getting my POST arrays to show all checkbox values from my form.
For some reason a <form> on my page won't hide/show using jQuery. I have
for some reason when I try to call CocoaAsyncSocket's onSocket:didReadData:withTag method, it's failing and
Input values <input type=hidden name=service_row[1]['row'] value=1 /> <input type=checkbox name=service_row[1]['check'] /> <input type=text name=service_row[1]['observation']
I've created a form that submits details via an email but for some reason
For some reason, this line of code is returning undefined for $(this).attr(href) $(a).attr(href, javascript:page('
For some reason I can't detect I can't set a z index for any
For some reason there's a variable called d that is defined immediately after I
For some reason the postback event keeps firing for my button. If I place
For some reason this isn't working, am I missing something obvious? RewriteRule ^(.*)infopopup.html$ /acatalog/infopopup.html

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.