Checkbox to submit a value different from 1/0 or true/false on check/uncheckTrigger a button click with JavaScript on the Enter key in a text boxHow can I convert a string to boolean in JavaScript?Setting “checked” for a checkbox with jQuery?How to check whether a checkbox is checked in jQuery?Sort array of objects by string property valueReference — What does this symbol mean in PHP?Testing if a checkbox is checked with jQueryHow do I make a placeholder for a 'select' box?What's the proper value for a checked attribute of an HTML checkbox?How do I bind to list of checkbox values with AngularJS?

Help me, I hate squares!

If the Moon were impacted by a suitably sized meteor, how long would it take to impact the Earth?

Reasons for using monsters as bioweapons

When did J.K. Rowling decide to make Ron and Hermione a couple?

IBM mainframe classic executable file formats

What are the effects of the elements on 3D printed objects made with "infused" PLA

UX writing: When to use "we"?

Can I shorten this filter, that finds disk sizes over 100G?

Is it unprofessional to mention your cover letter and resume are best viewed in Chrome?

"Fewer errors means better products" or "Fewer errors mean better products"?

How to derive trigonometric Cartesian equation from parametric

Get content of CMS Block in Magento 1.x

What is the most 'environmentally friendly' way to learn to fly?

May a hotel provide accommodation for fewer people than booked?

What is the name of this type of figure?

Went to a big 4 but got fired for underperformance in a year recently - Now every one thinks I'm pro - How to balance expectations?

Adjective for when skills are not improving and I'm depressed about it

"DDoouubbllee ssppeeaakk!!"

Is Norway in the Single Market?

Why do we need a voltage divider when we get the same voltage at the output as the input?

Russian pronunciation of /etc (a directory)

How to get values on a rastar layer to provide me with values

Could flaps be raised upward to serve as spoilers / lift dumpers?

Adding a (stair/baby) gate without facing walls



Checkbox to submit a value different from 1/0 or true/false on check/uncheck


Trigger a button click with JavaScript on the Enter key in a text boxHow can I convert a string to boolean in JavaScript?Setting “checked” for a checkbox with jQuery?How to check whether a checkbox is checked in jQuery?Sort array of objects by string property valueReference — What does this symbol mean in PHP?Testing if a checkbox is checked with jQueryHow do I make a placeholder for a 'select' box?What's the proper value for a checked attribute of an HTML checkbox?How do I bind to list of checkbox values with AngularJS?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








1















I have checkbox input field where



value = $variable // 1, 2, 3, 4, 5 ....


How to make it so that the checkbox always on check and uncheck to submit the value to the db?



<input type="checkbox" name="add_value[]" id="add-value" value="$variable">


The form needs to submit only unchecked checkboxes.










share|improve this question


























  • You cannot do that unless you write your own JavaScript code to gather the form field states and construct your own parameters. Browsers do not submit checkbox field parameters when the checkboxes are not checked.

    – Pointy
    Mar 26 at 22:59











  • How do I do the Javascript. I already submit and add it to the db. The tricky part is to do it on the uncheck action! Humm hummm

    – idm
    Mar 26 at 23:01






  • 1





    Why does the checkbox matter if it always submits the same value regardless of whether or not it's checked?

    – Benjamin
    Mar 26 at 23:03











  • When unchecked it doesn't submit anything. Or at leas I can't get it to submit whats in the value=. I need it to do so as i have other attributes in the form that need to be updated on this submission.

    – idm
    Mar 26 at 23:05












  • Before checkbox add input hidden with same name as checkbox is - if not checked, value will be read from hidden input.

    – Grzegorz Miśkiewicz
    Mar 26 at 23:25

















1















I have checkbox input field where



value = $variable // 1, 2, 3, 4, 5 ....


How to make it so that the checkbox always on check and uncheck to submit the value to the db?



<input type="checkbox" name="add_value[]" id="add-value" value="$variable">


The form needs to submit only unchecked checkboxes.










share|improve this question


























  • You cannot do that unless you write your own JavaScript code to gather the form field states and construct your own parameters. Browsers do not submit checkbox field parameters when the checkboxes are not checked.

    – Pointy
    Mar 26 at 22:59











  • How do I do the Javascript. I already submit and add it to the db. The tricky part is to do it on the uncheck action! Humm hummm

    – idm
    Mar 26 at 23:01






  • 1





    Why does the checkbox matter if it always submits the same value regardless of whether or not it's checked?

    – Benjamin
    Mar 26 at 23:03











  • When unchecked it doesn't submit anything. Or at leas I can't get it to submit whats in the value=. I need it to do so as i have other attributes in the form that need to be updated on this submission.

    – idm
    Mar 26 at 23:05












  • Before checkbox add input hidden with same name as checkbox is - if not checked, value will be read from hidden input.

    – Grzegorz Miśkiewicz
    Mar 26 at 23:25













1












1








1








I have checkbox input field where



value = $variable // 1, 2, 3, 4, 5 ....


How to make it so that the checkbox always on check and uncheck to submit the value to the db?



<input type="checkbox" name="add_value[]" id="add-value" value="$variable">


The form needs to submit only unchecked checkboxes.










share|improve this question
















I have checkbox input field where



value = $variable // 1, 2, 3, 4, 5 ....


How to make it so that the checkbox always on check and uncheck to submit the value to the db?



<input type="checkbox" name="add_value[]" id="add-value" value="$variable">


The form needs to submit only unchecked checkboxes.







javascript php html






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 26 at 23:58







idm

















asked Mar 26 at 22:57









idmidm

116 bronze badges




116 bronze badges















  • You cannot do that unless you write your own JavaScript code to gather the form field states and construct your own parameters. Browsers do not submit checkbox field parameters when the checkboxes are not checked.

    – Pointy
    Mar 26 at 22:59











  • How do I do the Javascript. I already submit and add it to the db. The tricky part is to do it on the uncheck action! Humm hummm

    – idm
    Mar 26 at 23:01






  • 1





    Why does the checkbox matter if it always submits the same value regardless of whether or not it's checked?

    – Benjamin
    Mar 26 at 23:03











  • When unchecked it doesn't submit anything. Or at leas I can't get it to submit whats in the value=. I need it to do so as i have other attributes in the form that need to be updated on this submission.

    – idm
    Mar 26 at 23:05












  • Before checkbox add input hidden with same name as checkbox is - if not checked, value will be read from hidden input.

    – Grzegorz Miśkiewicz
    Mar 26 at 23:25

















  • You cannot do that unless you write your own JavaScript code to gather the form field states and construct your own parameters. Browsers do not submit checkbox field parameters when the checkboxes are not checked.

    – Pointy
    Mar 26 at 22:59











  • How do I do the Javascript. I already submit and add it to the db. The tricky part is to do it on the uncheck action! Humm hummm

    – idm
    Mar 26 at 23:01






  • 1





    Why does the checkbox matter if it always submits the same value regardless of whether or not it's checked?

    – Benjamin
    Mar 26 at 23:03











  • When unchecked it doesn't submit anything. Or at leas I can't get it to submit whats in the value=. I need it to do so as i have other attributes in the form that need to be updated on this submission.

    – idm
    Mar 26 at 23:05












  • Before checkbox add input hidden with same name as checkbox is - if not checked, value will be read from hidden input.

    – Grzegorz Miśkiewicz
    Mar 26 at 23:25
















You cannot do that unless you write your own JavaScript code to gather the form field states and construct your own parameters. Browsers do not submit checkbox field parameters when the checkboxes are not checked.

– Pointy
Mar 26 at 22:59





You cannot do that unless you write your own JavaScript code to gather the form field states and construct your own parameters. Browsers do not submit checkbox field parameters when the checkboxes are not checked.

– Pointy
Mar 26 at 22:59













How do I do the Javascript. I already submit and add it to the db. The tricky part is to do it on the uncheck action! Humm hummm

– idm
Mar 26 at 23:01





How do I do the Javascript. I already submit and add it to the db. The tricky part is to do it on the uncheck action! Humm hummm

– idm
Mar 26 at 23:01




1




1





Why does the checkbox matter if it always submits the same value regardless of whether or not it's checked?

– Benjamin
Mar 26 at 23:03





Why does the checkbox matter if it always submits the same value regardless of whether or not it's checked?

– Benjamin
Mar 26 at 23:03













When unchecked it doesn't submit anything. Or at leas I can't get it to submit whats in the value=. I need it to do so as i have other attributes in the form that need to be updated on this submission.

– idm
Mar 26 at 23:05






When unchecked it doesn't submit anything. Or at leas I can't get it to submit whats in the value=. I need it to do so as i have other attributes in the form that need to be updated on this submission.

– idm
Mar 26 at 23:05














Before checkbox add input hidden with same name as checkbox is - if not checked, value will be read from hidden input.

– Grzegorz Miśkiewicz
Mar 26 at 23:25





Before checkbox add input hidden with same name as checkbox is - if not checked, value will be read from hidden input.

– Grzegorz Miśkiewicz
Mar 26 at 23:25












0






active

oldest

votes










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55367371%2fcheckbox-to-submit-a-value-different-from-1-0-or-true-false-on-check-uncheck%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes




Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.







Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55367371%2fcheckbox-to-submit-a-value-different-from-1-0-or-true-false-on-check-uncheck%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript