My php page has 3 dynamic drop-downs reading data from a MySQL db with select statements like this <select name="VehicleYear1" onchange="this.form.submit()">;. The drop-downs are all working fine, however, the first time the drop-down submits to the same page, I lose the $numcars value that I need to keep resubmitting to the form. All 3 drop-downs are contained within the same form.
<form action="selectpagetest2.php" method="post" name="SelectVehicle">
<input type="hidden" name="NumberofVehicles" value="<?=$numcars?>">
<?
$numcars=$_POST['NumOfCars2Quote'];
?>
I've tried many different ways (if, case, etc) to keep that initial value but I keep losing it when the drop-down submits to the form. It works if I just plug $numcars with a value like "ten" ($numcars = "ten"
but not if I try to do the assignment based on the value (NumOfCars2Quote) passed from the previous page. If I could somehow set that value the first time the page opens and then set it as a constant so it can't change every time the form is resubmitted, that would be great.
Any help would be appreciated.
Thanks,
Alexis
<form action="selectpagetest2.php" method="post" name="SelectVehicle">
<input type="hidden" name="NumberofVehicles" value="<?=$numcars?>">
<?
$numcars=$_POST['NumOfCars2Quote'];
?>
I've tried many different ways (if, case, etc) to keep that initial value but I keep losing it when the drop-down submits to the form. It works if I just plug $numcars with a value like "ten" ($numcars = "ten"
Any help would be appreciated.
Thanks,
Alexis