Getting Values of Uncheck Checkboxes

Getting Values of Uncheck Checkboxes

By : Quantum Sky
Date : November 15 2020, 06:54 AM
around this issue Based on your updated question, a modified and adjusted answer. Have a look at the code below; it does what you want. By the way, I'm using prefix-chars for variables to easier identify the datatype (a = for arrays, i = for ints, r = for resources etc.). Also I'd like to advice you to Look into PDO or MySQLi libraries since mysql-library is deprecated (as of PHP 5.5.x).
code :
    $rConnection = mysql_select('localhost', 'root', 'yourpwd');
    mysql_select_db('yourdb', $rConnection);

    $rQuery = mysql_query("
        SELECT      * 
        FROM        `professors` 
        WHERE       `fac_stat` = 1
        ORDER BY    `Faculty_status` DESC,
                    `Faculty_name` ASC");

    $aAllCheckboxValues = array();

    while($aRow = mysql_fetch_assoc($rQuery)) {
        $aAllCheckboxValues[] = $aRow['Faculty_code'];

    if(isset($_POST['btnSubmit'])) {
        $aChecked   = array();
        $aUnchecked = array();

        foreach($_POST['chkFile'] as $sFacultyCode) {
            # Validate if the value of the posted checkbox is valid
            if(in_array($sFacultyCode, $aAllCheckboxValues)) {
                $aChecked[] = $sFacultyCode;

        $aUnchecked = array_diff($aAllCheckboxValues, $aChecked);

        echo '<pre>';
        echo 'Checked:';
        echo 'Unchecked:';
        echo '</pre>';
<form name="formDemo" method="post" action="">
    <?php foreach($aAllCheckboxValues as $sFacultyCode) { ?>
    <input type="checkbox" name="chkFile[]" value="<?php echo $sFacultyCode ?>"/> <?php echo $sFacultyCode ?><br/>
    <?php } ?>
    <input type="submit" name="btnSubmit" value="Submit"/>

Share : facebook icon twitter icon
check uncheck All checkboxes and count values using data attributes

check uncheck All checkboxes and count values using data attributes

By : hamza khemili
Date : March 29 2020, 07:55 AM
this will help Take a look at this Codepen: http://cdpn.io/EbCux to see if i have understood what you need and if it fixes your problem.
Javascript check/uncheck all checkboxes and write values to textarea

Javascript check/uncheck all checkboxes and write values to textarea

By : user3394790
Date : March 29 2020, 07:55 AM
seems to work fine This is my first js script so be gentle with me :) , Replace your check and uncheck functions with this
code :
function check(chk) {
    for (i = 0; i < chk.length; i++)
        chk[i].checked = true ;

function uncheck(chk) {
    for (i = 0; i < chk.length; i++)
        chk[i].checked = false ;
React - How to check/uncheck checkboxes in a loop whose values come from redux store

React - How to check/uncheck checkboxes in a loop whose values come from redux store

By : Chris fw
Date : March 29 2020, 07:55 AM
wish help you to fix your issue Look at he last line in input, it basically evaluates if email in current row is in particular category, and if yes it renders checked=true, otherwise renders nothing
code :
   {...(row.emailCategoryList.crmEmails ? {checked: true} : {}) }
<MyMailCheck row={row} idPrefix="sttng1" rowKey="crmEmails"/>
const emailCategoryClick = (email, category) => ({
export default connect(
 (state) => ({}),
 (dispatch) => ({catClick: (email, cat) => () => {dispatch(emailCategoryClick(email, cat))} })
   {...(row.emailCategoryList.crmEmails ? {checked: true} : {}) }
   onCLick={catClick(row.email, "crmEmails")}
Save check and uncheck values from checkboxes

Save check and uncheck values from checkboxes

By : Sarmad
Date : March 29 2020, 07:55 AM
wish of those help I have this form:
code :
        <form name="settings" action="../ajax/account/account_ajax.php?token=<?php echo $token; ?>" class="form-horizontal" method="post">
            <input type="hidden" name="set_settings" value="1">
            <div class="row">
                <div class="col-md-5">
                    <label class="checkbox-custom">
                        <input name="earning_sound" class="earning_sound" type="checkbox" value="<?php echo ($settings->earning_sound == 1)? '1' : '0' ?>" <?php echo ($settings->earning_sound == 1)? 'checked' : '' ?>  />
                        <i class="fa fa-fw fa-square-o checked"></i>
                        Earning Notification Sound
                    <button type="submit" class="btn btn-primary "><span class="fa fa-edit"></span> Save</button>
$(".earning_sound").click(function() {
    $(this).val(this.checked ? 1 : 0);          
Not able to remove values from array after uncheck in checkboxes

Not able to remove values from array after uncheck in checkboxes

By : Nelym Daocan Lorib
Date : March 29 2020, 07:55 AM
fixed the issue. Will look into that further it could be helpful to you what I had changed here is the variable creation var pc=[] inside the check()
code :
    function check(){
        var pc = [];
        pc = $.unique(pc);
        document.getElementById("result").value = pc.join("\n");
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
    <body onload ="check()">
    <input type="checkbox" name="category" value="a/b" onclick="check()" checked>
    <input type="checkbox" name="category" value="c/d" onclick="check()" checked>
    <input type="checkbox" name="category" value="e/f" onclick="check()" checked>
    <input type="checkbox" name="category" value="g/h" onclick="check()" >

    <textarea id="result"></textarea>
Related Posts Related Posts :
  • How to add Smarty templating engine to CodeIgniters 3 framework?
  • Am I maxing out possible data insert
  • Redirect to homepage without changing address bar URL
  • What is the best user-Id Value for a MySql "users" table
  • PHP $_COOKIE is only available in one directory
  • php regular expressions documantation
  • cannot import too large sql file to mysql
  • not getting appilcation/json in content-type in header
  • Only the first data display from my database but other shows but not on a table
  • Is it possible to have a print button link as the content of the mail
  • how to extract full mail address in imap php
  • Alternative to output buffering to put eval'd code into a variable
  • how to run wordpress php snippet mysql update command from ssh and/ultimately cron
  • how to get xml tag by name
  • ModSecurity maximum post limits (PCRE limit errors)
  • Call controller/action in event listener
  • How to improve performance of contacting WebService?
  • PHP nest variable in echoed string that contains a HTML tag in the end
  • Multiple Ajax request for PHP framework
  • Debug Info from Moodle Plugin
  • passing variables through page
  • Passing PHP $result data to Javascript
  • cakePHP File Download was not found or not readable
  • batch waiting until script finishes
  • PHP variables and anchors in URL
  • php eTag generation using php
  • How to check whether the array is an Integer or Not?
  • Is it possible to install Doctrine without PEAR or Composer? If so, how?
  • Call view script of (parent) Abstract controller Zend
  • Curl PHP cannot display amazon
  • Symfony, getters and setters vs magic methods
  • Using 'continue' PHP instruction outside the loop
  • AJAX POST return data not appearing
  • Can I query relations using an INNER JOIN instead of two queries in Eloquent?
  • Looping through dynamic form fields and inserting into database
  • My php code can't select mysql auto_increment value
  • Store Angularjs form data in database using php
  • I want to run my sh file continuously even if I close my Putty connection
  • file_get_contents equivalent for gzipped files
  • Include PHP file with jQuery
  • php curl headers do not return from website?
  • How to find out, if facebook ID is a user, group or page
  • Connect webhost database to android database
  • preg_match get div content with class
  • Upload multiple files in Laravel 4
  • Count array numbers in multidimensional array
  • PHP Date diff with a difference
  • Search Customer by custom field in Netsuite
  • Is it possible to hide/encode/encrypt php source code and let others have the system?
  • list items to be displayed using php code and array
  • check if row exists mysqli
  • PHP errors loading MySQL
  • setup PostgreSQL with Laravel in MAMP
  • PHP - CodeIgniter Notifications
  • Encrypting a password column in a SQL database
  • New to PHP, trying to extract information from another website
  • JavaScript AmChart to Image for Email
  • Is javascript validation enough to keep my forms secure?
  • Regex extract variables from [shortcode]
  • Download a .mp3 link and save it to computer with PHP
  • shadow
    Privacy Policy - Terms - Contact Us © ourworld-yourmove.org