Tallying up form
Posted: Wed Jul 29, 2009 7:12 am
Hi im trying to setup a form, what i need it to do is at the end tally up all the choices off a, b or c for each question and then display.
Your choose mostly: A
Your choose mostly: B
Your choose mostly: C
This is where i am so far im new to php can someone help me please?
<style type="text/css">
p.head {
color:#F00;
font-family:Arial, Helvetica, sans-serif;
font-weight:700;
}
</style>
<form method="POST" action="">
<p class="head">How often do you launch a new product or service?</p>
<input type="radio" name="group1" id="1a" value="a" />A) Every year we launch new products – most of our growth comes from these. <br/>
<input type="radio" name="group1" id="1b" value="b" />B) It’s been a long time, but customers are happy with the products we have in our range. <br/>
<input type="radio" name="group1" id="1c" value="c" />C) We concentrate on keeping prices down, there’s too much competition out there.<br/>
<p class="head">Are there any new markets you could sell to?</p>
<input type="radio" name="group2" id="2a" value="a" />A) A. Yes, we’re discovering lots of new application for our products & services, especially export markets. <br/>
<input type="radio" name="group2" id="2b" value="b" />B) B. I’m looking at collaborating with other companies to get into new markets. <br/>
<input type="radio" name="group2" id="2c" value="c" />C) C. All my time is taken up defending our position and keeping the customers we have. </p>
<p class="head">How do you win new customers?</p>
<input type="radio" name="group3" id="3a" value="a" />A) A. Our products and services are unique – people tell us we are the number-one supplier. <br/>
<input type="radio" name="group3" id="3b" value="b" />B) B. We follow-up every quotation to find out who won the business, <br/>
<input type="radio" name="group3" id="3c" value="c" />C) C. We lost a big customer recently, and I need to work out how to replace those sales
<br/>
<p><input type="submit" name="submit"> </p>
</form>
<?php
//The variables from the form in the previous page collected here:
$rad=$_POST['group1'];
$rad=$_POST['group2'];
$rad=$_POST['group3'];
//"select1" and "R1" are the names of form elements
//the values of the form elements are given to these variables
//and we show them below:
echo "You chose mostly: ".$rad."<br>";
?>
Its only giving me the result of the lest group as i said im new to php do i need to run an array through the questions?
Your choose mostly: A
Your choose mostly: B
Your choose mostly: C
This is where i am so far im new to php can someone help me please?
<style type="text/css">
p.head {
color:#F00;
font-family:Arial, Helvetica, sans-serif;
font-weight:700;
}
</style>
<form method="POST" action="">
<p class="head">How often do you launch a new product or service?</p>
<input type="radio" name="group1" id="1a" value="a" />A) Every year we launch new products – most of our growth comes from these. <br/>
<input type="radio" name="group1" id="1b" value="b" />B) It’s been a long time, but customers are happy with the products we have in our range. <br/>
<input type="radio" name="group1" id="1c" value="c" />C) We concentrate on keeping prices down, there’s too much competition out there.<br/>
<p class="head">Are there any new markets you could sell to?</p>
<input type="radio" name="group2" id="2a" value="a" />A) A. Yes, we’re discovering lots of new application for our products & services, especially export markets. <br/>
<input type="radio" name="group2" id="2b" value="b" />B) B. I’m looking at collaborating with other companies to get into new markets. <br/>
<input type="radio" name="group2" id="2c" value="c" />C) C. All my time is taken up defending our position and keeping the customers we have. </p>
<p class="head">How do you win new customers?</p>
<input type="radio" name="group3" id="3a" value="a" />A) A. Our products and services are unique – people tell us we are the number-one supplier. <br/>
<input type="radio" name="group3" id="3b" value="b" />B) B. We follow-up every quotation to find out who won the business, <br/>
<input type="radio" name="group3" id="3c" value="c" />C) C. We lost a big customer recently, and I need to work out how to replace those sales
<br/>
<p><input type="submit" name="submit"> </p>
</form>
<?php
//The variables from the form in the previous page collected here:
$rad=$_POST['group1'];
$rad=$_POST['group2'];
$rad=$_POST['group3'];
//"select1" and "R1" are the names of form elements
//the values of the form elements are given to these variables
//and we show them below:
echo "You chose mostly: ".$rad."<br>";
?>
Its only giving me the result of the lest group as i said im new to php do i need to run an array through the questions?