timmah1 Posted December 10, 2008 Share Posted December 10, 2008 I have a list of items for sale. My items are listed with radio buttons <input name="package_[<?=$a[name]; ?>]" type="radio" value="<?=$a[price];?>"><?=$a[name];?>: <?=$a[price];?> If I'm using this to grab everything that was clicked while (list ($name,$val) = @each ($_POST['package_'])) { echo "$name $val"; } How can I add all the values together to get a total price? Thanks in advance Quote Link to comment Share on other sites More sharing options...
premiso Posted December 10, 2008 Share Posted December 10, 2008 while (list ($name,$val) = @each ($_POST['package_'])) { echo "$name $val"; $total += $val; } echo "Total: " . $total; Quote Link to comment Share on other sites More sharing options...
timmah1 Posted December 10, 2008 Author Share Posted December 10, 2008 Awesome! Thanks again premiso Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.