lundi 23 mai 2016

How to sum the values of checked checkboxes from an HTML form in a PHP script

I am having some dificulties with a PhP script that is sent data from an HTML form.

Basically on the form I have multiple checkboxes each with a numeric value. I want the PHP to output the sum of the values from only the checked checkboxes.

So if checkbox 1 had a value of 10, 2, a value of 15, and 3 a value of 20 and the user checked 1 and 3 and clicked submit it would output 30.

Any help appreciated.

Thank you!




Aucun commentaire:

Enregistrer un commentaire