Hi,
Could you guys/gals tell me how I should approach this:
I have to do an "online auto calculator" that tabulates the values submitted in an html form and generate the results.
Some tell me I should use javascript as php is harder.
Or should I use both ? Please advice.
Any help is greatly appreciated. Thanks in advance
Something like:
// Please select the fruit you want:
<select name="fruits">
<option value= "apple">apple</option>
<option value= "orange">orange</option>
<option value= "pear">pear</option>
</select>
// Please enter the quantity:
<input name="amount" type="text">
// Then the calculation will go something like:
if ($_POST['fruits'] == "apple") {
$cost = "2";
} elseif ($_POST['fruits'] == "orange") {
$cost = "3.50";
} elseif ($_POST['fruits'] == "pear") {
$cost = "4";
// Then I get the $cost multiply by the $amount,
and get the result.
Is this how I should do it?