I have a select box in a form that produces a financial proposal. The select box has 4 options:
<select name="warranty">
<option value="<?php echo $deductions["warranty48month"] ?>">48 Months</option>
<option value="<?php echo $deductions["warranty36month"] ?>">36 Months</option>
<option value="<?php echo $deductions["warranty24month"] ?>">24 Months</option>
<option value="<?php echo $deductions["warranty12month"] ?>">12 Months</option>
</select>
The user selects the option they require and finally clicks a "Calculate" button, which reloads the form with all of the figures displayed and calculations performed.
However if the user selected, for example 2 years warranty, when the form is reloaded the select box displays the 48 Months value and not, as in this example, 2 years warranty.
I have seen some similar requests along time ago but I do not yet understand what the code does or how to use it. I have included a sample taken from a thread last year that is supposed to do what I require:
<?php
$cc[]='discover';
$cc[]='visa';
$cc[]='amex';
echo "<select name=credit>";
echo "<option value=>Select One";
for($i=0; $i < sizeof($cc); $i++)
{
$sel=($cc[$i] == $credit) ? ' selected' : '';
echo "<option$sel value=$cc[$i]>$cc[$i];
}
echo "</select>";
?>
How do I use something like this to solve my problem?
I would be very grateful if anyone has a solution as I am getting stressed about this and the deadline to complete my project is tomorrow.
Kind regards
Dean