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 Link to comment https://forums.phpfreaks.com/topic/136389-solved-adding-variable/ 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; Link to comment https://forums.phpfreaks.com/topic/136389-solved-adding-variable/#findComment-711663 Share on other sites More sharing options...
timmah1 Posted December 10, 2008 Author Share Posted December 10, 2008 Awesome! Thanks again premiso Link to comment https://forums.phpfreaks.com/topic/136389-solved-adding-variable/#findComment-711669 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.