radio button loop and calculate numeric values

I am working on a questionnaire page.

I have 20 question. Ten on one page and 10 on the other.

What I am trying to accomplish is that when a client select each radio button on page one.
Take the value which is a number loop through each radio button group on the page.
add those value and total and pass that subtotal to page two with all the selected button

take the subtotal and after client have selected all the radio and or check boxes on the
page two add with subtotal to create a grand total. Then email selected to me.

I know how to do the session parameter pass similar to .net, I know how do the email.

I am have problems with the addition portion of the code.

[code]<?php

// session_start();

// check for submission
// retrieve value from posted data
if ($_POST[‘next’])
{
$contact = $_POST[‘contactbx’];
$exptotal = $_POST[‘experiencebx’];
$biosysequipment = $_POST[‘bioequipmentbx’];
$neurosysequipment = $_POST[‘neuroequipmentbx’];
$goal = $_POST[‘goalbx’];
$ebusiness = $_POST[‘ebusinessbx’];
$customer = $_POST[‘customerbx’];
$clientbx = $_POST[‘clientbx’];
$subtotal = 0;

foreach($exptotal as $etotal)
 {
	 $answer = $etotal + $subtotal;
 }
foreach($contact as $ctotal)
 {
	 $canswer = $ctotal + $subtotal;
 }
 foreach($biosysequipment as $btotal)
 {
	 $banswer = $btotal + $subtotal;
 }
$vtotal = $canswer + $answer;
$ttotal = $banswer + $vtotal;

echo $ttotal;
/*header("Location: gettingstarted2.php");
exit;    */

}

?>[/code]

Here is my html code as well

<form id="form1" method="post" action="processor.php" name="thisForm"> <table width="960" height="729" border="0"> <tr> <th colspan="2" align="left" scope="row"> <img src="gettingstartedlogo.jpg" width="612" height="248" /> </th> </tr> <tr> <th width="101" align="left" scope="row">Name:</th> <td width="1013"> <input name="name" type="text" id="name" size="30" maxlength="50" /> </td> </tr> <tr> <th align="left" scope="row">Address:</th> <td><input name="address" type="text" id="address" size="30" maxlength="50" /></td> </tr> <tr> <th align="left" scope="row">Email:</th> <td><input name="address" type="text" id="address" size="30" maxlength="50" /></td> </tr> <tr> <th align="left" scope="row">Phone:</th> <td><input name="phone" type="text" id="phone" size="30" maxlength="50" /></td> </tr> <tr> <th colspan="2" align="left" scope="row">Would you like ust contact you? <label> <input type="radio" name="contactbx" value="0" id="contactbx_0" />Yes</label> <label><input type="radio" name="contactbx" value="0" id="contactbx_1" />No</label> </th> </tr> <tr> <th colspan="2" align="left" scope="row">My experience level is: <p> <label> <input type="radio" name="experiencebx" value="5" id="experiencebx_0"/> Brand New</label> <label> <input type="radio" name="experiencebx" value="10" id="experiencebx_1"/> Less than 2 years</label> <label> <input type="radio" name="experiencebx" value="15" id="experiencebx_2"/> 2-5 years</label> <label> <input type="radio" name="experiencebx" value="20" id="experiencebx_3"/> 5-10 years</label> <label> <input type="radio" name="experiencebx" value="30" id="experiencebx_4"/> 10+ years</label> </p></th> </tr> <tr align="left"> <th colspan="2" align="left" scope="row">Do you currently own biofeedback equipment? <label> <input type="radio" name="bioequipmentbx" value="10" id="bioequipmentbx_0" /> Yes Type: </label><input name="bioequipmentbx" type="text" id="biotype" size="35" maxlength="100" /> <label> <input type="radio" name="bioequipmentbx" value="5" id="bioequipmentbx_1" />No</label> <br /> Do you currently own neurofeeback equipment? <label> <input type="radio" name="neuroequipmentbx" value="10" id="neuroequipmentbx_0" /> Yes Type: </label><input name="neuroequipment" type="text" id="neurotype" size="35" maxlength="100" /> <label> <input type="radio" name="neuroequipmentbx" value="5" id="neuroequipmentbx_1" />No</label></th> </tr> <tr> <th colspan="2" align="left" scope="row">My goal is to: <p> <label> <input type="radio" name="goalbx" value="10" id="goalbx_0" /> continue in my business</label> <br /> <label> <input type="radio" name="goalbx" value="20" id="goalbx_1" /> move my business from my home to an office setting</label> <br /> <label> <input type="radio" name="goalbx" value="30" id="goalbx_2" /> expand my business using the lastest technological developments</label> <br /> </p></th> </tr> <tr align="left"> <th colspan="2" align="left" scope="row">Getting into your business: <br /> <p> <label> <input type="radio" name="ebusinessbx" value="20" id="ebusinessbx_0" /> I am a licensed practitioner </label> <label for="espec1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Specialty</label> <input name="espec1" type="text" id="espec1" size="30" maxlength="150" /> <br /> <label> <input type="radio" name="ebusinessbx[]" value="5" id="ebusinessbx_1" onClick="radiounhide()" /> I am an unlicensed practitioner</label> <label for="espec2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Specialty</label><input name="espec2" type="text" id="espec2" size="30" maxlength="150" /> <br /> <label><input type="radio" name="ebusinessbx" value="10" id="ebusinessbx_2" onClick="radiounhide()" />I am opening a new business </label> <br /> <label> <input type="radio" name="ebusinessbx" value="30" id="ebusinessbx_3" onClick="radiounhide()" />I have an existing business </label> <blockquote> <label id="ebusinessbx_4"> <input type="checkbox" name="ebusinessbx" value="30" id="ebusinessbx_4"/>I want to expand therapies within my practice </label> <label id="ebusinessbx_5"> <input type="checkbox" name="ebusinessbx" value="30" id="ebusinessbx_5" />I want to add neurofeedback within my practice</p> </label> </blockquote> </th> </tr> <tr> <th height="130" colspan="2" align="left" scope="row">My present customer base includes (Check all that apply):<br /> <p> <label> <input type="checkbox" name="customerbx[]" value="5" id="customerbx_0" /> children</label> <br /> <label> <input type="checkbox" name="customerbx[]" value="5" id="customerbx_1" /> adoloescents</label> <br /> <label> <input type="checkbox" name="customerbx[]" value="5" id="customerbx_2" /> adults</label> <br /> <label> <input type="checkbox" name="customerbx[]" value="15" id="customerbx_3" /> all of the above</label> </p> </th> </tr> <tr> <th colspan="2" align="left" scope="row">My clients are:<br /> <p> <label> <input type="radio" name="clientbx" value="5" id="clientbx_0" /> local</label> <br /> <label> <input type="radio" name="clientbx" value="5" id="clientbx_1" /> distant</label> <br /> <label> <input type="radio" name="clientbx" value="30" id="clientbx_2" /> both local and distant</label> <br /> <label> <input type="radio" name="clientbx" value="10" id="clientbx_3" /> local, but I would like to expand to serve more distant clients</label> </p> </th> </tr> <tr> <th colspan="2" align="left" scope="row"><input type="submit" name="next" value="next" width="67px" /></th> </tr> </table> </form>

Problem fixed I had a box label wrong.

Sponsor our Newsletter | Privacy Policy | Terms of Service