• 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

php curl_exec() Connection refused when retrieving a remote image

could not find driver Debian SQL Server PHP

How to create a scheduler application in php

How can I get user id from session in javascript?

How to get AJAX to post on second page?

How to install LDAP in Docker php-fpm alpine

Transpose and flatten two-dimensional indexed array where rows may not be of equal length

Store multiple fields in JSON column (Nova CMS)

Uncaught TypeError: Cannot read property 'length' of null when retrieving tags from wp

PHP AWS Cognito 'Error executing "SignUp" : ResourceNotFoundException : User pool client XXXX does not exist

How to make a array inside array?

How to validate tin and cst using PHP?

api response laravel doesn't show

How to get AJAX to post on second page?

Telegram bot doesn't answer

About Contact Privacy policy Terms and conditions