When the form passes a value, how do I pass the value of the unselected checkbox to the background?

Today, when adjusting the interface to the background, there is a checkbox check box on the page. If selected, the form form submission will send the value value to the background as y; if it is not selected, how to send the value to n? -because if checked is not selected, form will not send this field when it is submitted.

I judged the status of the check box before submit. If it is not selected, the value is assigned to n; but it does not take effect, how do the gods deal with it?

Mar.03,2021

asp.net mvc is handled by matching each checkbox with a hidden, when checkbox is not selected, setting the value of hidden; when checkbox is selected, the disable hidden
is much easier if it is submitted by ajax


the usage scenario needs to be described more clearly:
1. Can you get unchecked items? The above code seems to be OK. Whether it is a value or not, an error unselected value is not equal to'
2. Now that you can get the selected ones, can you use all the data Filter to drop the selected items and get the unselected data?


multiple checkbox, setting values

 var Fruits = $('[name="Fruit"]');
  var FruitsArray = Array.prototype.slice.call(Fruits);

  FruitsArray.forEach((v, index) => {
    v.onclick = function () {
      v.value = 'y'
    }
    for (var i = 0; i < FruitsArray.length; iPP) {
      if (!FruitsArray[i].checked) {
        FruitsArray[i].value = 'n'
      }
    }

  });
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e4c022-44e7d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e4c022-44e7d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?