• Categories
    • PHP
    • phpMyAdmin
    • PHPMailer
    • FFMpeg
    • PHPEXcel
    • PHPDoc
    • PHPUnit
    • CakePHP
    • CakePHP 2.0
    • Cake PHP 2.1
    • CakePHP Model
    • Facebook PHP SDK
    • composer-php
    • PHP 7
    • PHP GD
    All Categories
  • About

Send same name multiple checkbox values via ajax

javascriptphpjqueryajax


PHP Snippet 1:

var checked = [];
$("input[name='userpages[]']:checked").each(function ()
{
    checked.push(parseInt($(this).val()));
});

PHP Snippet 2:

var data = []

$('input[name="userpages[]"').each (function (index, element) {
    data[$(element).attr('id')] = $(element).val();
});
console.log(data);

Related Snippets

Loading data from MySQL and populating dropdown select with jQuery Mobile, PHP

How to change the app environment at run time?

Laravel 5.1 Unknown database type enum requested

protect my blog content

What is the function of the (new Date()).getTime() in PHP?

Set quantity minimum, maximum and step at product level in Woocommerce

PHP Find Array Index value in multi-line array

Custom Button next to “ADD TO CART” button of WooCommerce based on Product Type

How to add a heading in between checkout fields of WooCommerce

Can I use a WooCommerce function without any WooCommerce page?

PHP array, move keys and values to new array, but mix it up

CodeIgniter force_download is not working

Respond with status code 401 on authentication failure using Laravel and Passport?

With doctrine ODM, can I embed many subdocuments in a main document?

Chunk and transpose a flat array into rows with a specific number of columns

About Contact Privacy policy Terms and conditions