Hi Folks
Need some massive help. I am trying to do a registration page and in this page there are various options for users to choose.
Based on what they have chosen, they will be shown the price.
The choices is done by different radio button groups.
I have been trying to do dynamic checking of the radio button and displaying the results using if/if else conditions that adds up different value.
The results of the radio button does not seems to be captured.
HTML Code:
<h2><span>Registration</span></h2>
<div class="clr"></div>
<p><font color="#009966">Registration Selection</font> <br /><font size="-5">Price includes 7% GST</font> </p>
<p><font color="#009966">Please select one. Do note that if you are a delegate, your package includes the banquet</font></p>
<p>
<label>
<input type="radio" name="f" value="856" id="RadioGroup1_0" />
F1 Standard</label>
<br />
<label>
<input type="radio" name="f" value="535" id="RadioGroup1_1" />
F2 Students</label>
<br />
</p>
<p><font color="#009966">Please select one. If you have selected the CB3, please indicate how many pax in the field below.</font></p>
<p>
<label>
<input type="radio" name="cb" value="0" id="RadioGroup2_0" />
CB1 Conference Delegate (Category F1)</label>
<br />
<label>
<input type="radio" name="cb" value="100" id="RadioGroup2_1" />
CB2 Students</label>
</p>
<p>
<label>
<input name="ap" type="radio" value="120" />Accompanying Person</label>
</p>
<p>
<label>Number of pax for above
<input type="text" name="person" id="person" />
</label>
</p>
PHP Code:
<?php
$value = 0;
echo $f;
echo $cb;
if ($f == 856 && $cb == 0)
{
$value = 856;
echo "1";
}
else if ($f == 856 && $cb == 100 && $ap == "")
{
$value = 856;
echo "You are already covered for banquet and the selection you have check is for students";
}
else if ($f == 856 && $cb == 0 && $ap == 120)
{
$value = ($person * 120) + 856;
echo "You are already covered for banquet and the selection you have check is for students";
}
else if ($f == 535 && $cb == 0 && $ap == "")
{
$value = 535;
echo "You have indicated that you are a student and that does not entitled you to the banquet unless you have selected the second option";
}
else if ($f == 535 && $cb == 100 && $ap == "")
{
$value = 635;
}
else if ($f == 535 && $cb == 100 && $ap == 120)
{
$value = ($person * 120) + 100 + 856;
}
echo $value;
?>
<p><font color="#009966">From your selection, you will have to pay $<?php echo $value; ?>.</font></p>
If anyone can point out any mistake i have made or suggest a better way of doing this, i will be grateful ...
thanks all for reading !!
Last edited by NullPointer; 02-09-2012 at 01:48 PM..
|