DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   PHP (http://www.daniweb.com/forums/forum17.html)
-   -   checkbox values calculation with PHP (http://www.daniweb.com/forums/thread30654.html)

egoleo Aug 16th, 2005 3:38 pm
checkbox values calculation with PHP
 
I have checkboxes with an amount as values.
Can someone help on how to fine the total of
checkbox values and sent to an email using php?

techniner Aug 17th, 2005 12:39 pm
Re: checkbox values calculation with PHP
 
Put the check boxes in a form
<form method="post">
<input TYPE="checkbox" NAME="five" VALUE="5" checked>Five
<input TYPE="checkbox" NAME="ten" VALUE="10" checked>Ten
<input type="submit" name="go" value"Submit This">
<form>


Then Above that you put:
<?

if ($go) {

$add_this=$_POST['five'];
$add_that=$_POST['ten'];
$total=$add_this+$add_that;

echo $total;
}
?>

egoleo Aug 18th, 2005 9:59 am
Re: checkbox values calculation with PHP
 
Thanks. but It did not work. When i click on it nothing happens.
maybe i should show u the site which i am using it on so that u can help me on it.

techniner Aug 18th, 2005 10:56 am
Re: checkbox values calculation with PHP
 
Yes. Paste me your code and I will do it for you.


All times are GMT -4. The time now is 6:00 am.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC