CPD
07-28-2012, 12:46 AM
What I need to do is based on the "guest" select I need to multiply the rate selects
<?php
if($date != null && is_numeric($date) && $region != null && $vid != null && $sid != null)
{
?>
<tr><td>Number of Guests</td><td>
<select name="guest" onChange="autoSubmit();">
<option value="null">Select Guests</option>
<option value="1" <?php if($guest == 1) echo " selected"; ?>>One</option>
<option value="2" <?php if($guest == 2) echo " selected"; ?>>Two</option>
<option value="3" <?php if($guest == 3) echo " selected"; ?>>Three</option>
<option value="4" <?php if($guest == 4) echo " selected"; ?>>Four</option>
<option value="5" <?php if($guest == 5) echo " selected"; ?>>Five</option>
<option value="6" <?php if($guest == 6) echo " selected"; ?>>Six</option>
<option value="7" <?php if($guest == 7) echo " selected"; ?>>Seven</option>
<option value="8" <?php if($guest == 8) echo " selected"; ?>>Eight</option>
</select>
</td><tr>
<?php
}
?>
<!------This makes sure that the above selects and inputs are filled first------>
<?php
if($guest != null && is_numeric($guest) && $region != null && $vid != null && $sid != null && $date != null)
{
?>
<?
$si=1;
function guest(){
?>
<!------------------------------------------------------------------------------>
<!--------This seventh select selects the SHOW RATES based on the SHOW ID------->
<tr><td>Select Show Rates</td><td>
<select name="rate" onChange="autoSubmit();">
<option value="null">Select Show Rates</option>
<?php
$sql4 = "SELECT * FROM vshows WHERE sid = $sid ";
$rates = mysql_query($sql4,$conn);
while($row = mysql_fetch_array($rates))
{
echo ("<option value=\"$row[sratek]\" " . ($rate == $row["sratek"] ? " selected " : "") . ">$row[sratek]</option>");
echo ("<option value=\"$row[sratea]\" " . ($rate == $row["sratea"] ? " selected " : "") . ">$row[sratea]</option>");
echo ("<option value=\"$row[sratef]\" " . ($rate == $row["sratef"] ? " selected " : "") . ">$row[sratef]</option>");
echo ("<option value=\"$row[srateo]\" " . ($rate == $row["srateo"] ? " selected " : "") . ">$row[srateo]</option>");
echo ("<option value=\"$row[sratecomp]\" " . ($rate == $row["sratecomp"] ? " selected " : "") . ">$row[sratecomp]</option>");
}
?>
</select>
</td><tr>
<?php
}
?>
<?
if ($guest > $si) {
print "Next Guest";
return guest() ; // restart process
}
$si++
}
?>
So if the "guest Select is 4, then I need to have 4 of the "rate" drop downs, and to increment the drop down name and vars by that amount
eg.
rate $var
rate1 $var1
rate2 $var2
rate3 $var3
So if there are 4 guests selected then
guest 1 is an adult rate will be .......
guest 2 is an adult rate1 will be......
guest 3 is a senior rate 2 will be .....
guest 4 is a child rate3 will be.......
I tried to do a function guest as seen above but it don't work
any thoughts ??
<?php
if($date != null && is_numeric($date) && $region != null && $vid != null && $sid != null)
{
?>
<tr><td>Number of Guests</td><td>
<select name="guest" onChange="autoSubmit();">
<option value="null">Select Guests</option>
<option value="1" <?php if($guest == 1) echo " selected"; ?>>One</option>
<option value="2" <?php if($guest == 2) echo " selected"; ?>>Two</option>
<option value="3" <?php if($guest == 3) echo " selected"; ?>>Three</option>
<option value="4" <?php if($guest == 4) echo " selected"; ?>>Four</option>
<option value="5" <?php if($guest == 5) echo " selected"; ?>>Five</option>
<option value="6" <?php if($guest == 6) echo " selected"; ?>>Six</option>
<option value="7" <?php if($guest == 7) echo " selected"; ?>>Seven</option>
<option value="8" <?php if($guest == 8) echo " selected"; ?>>Eight</option>
</select>
</td><tr>
<?php
}
?>
<!------This makes sure that the above selects and inputs are filled first------>
<?php
if($guest != null && is_numeric($guest) && $region != null && $vid != null && $sid != null && $date != null)
{
?>
<?
$si=1;
function guest(){
?>
<!------------------------------------------------------------------------------>
<!--------This seventh select selects the SHOW RATES based on the SHOW ID------->
<tr><td>Select Show Rates</td><td>
<select name="rate" onChange="autoSubmit();">
<option value="null">Select Show Rates</option>
<?php
$sql4 = "SELECT * FROM vshows WHERE sid = $sid ";
$rates = mysql_query($sql4,$conn);
while($row = mysql_fetch_array($rates))
{
echo ("<option value=\"$row[sratek]\" " . ($rate == $row["sratek"] ? " selected " : "") . ">$row[sratek]</option>");
echo ("<option value=\"$row[sratea]\" " . ($rate == $row["sratea"] ? " selected " : "") . ">$row[sratea]</option>");
echo ("<option value=\"$row[sratef]\" " . ($rate == $row["sratef"] ? " selected " : "") . ">$row[sratef]</option>");
echo ("<option value=\"$row[srateo]\" " . ($rate == $row["srateo"] ? " selected " : "") . ">$row[srateo]</option>");
echo ("<option value=\"$row[sratecomp]\" " . ($rate == $row["sratecomp"] ? " selected " : "") . ">$row[sratecomp]</option>");
}
?>
</select>
</td><tr>
<?php
}
?>
<?
if ($guest > $si) {
print "Next Guest";
return guest() ; // restart process
}
$si++
}
?>
So if the "guest Select is 4, then I need to have 4 of the "rate" drop downs, and to increment the drop down name and vars by that amount
eg.
rate $var
rate1 $var1
rate2 $var2
rate3 $var3
So if there are 4 guests selected then
guest 1 is an adult rate will be .......
guest 2 is an adult rate1 will be......
guest 3 is a senior rate 2 will be .....
guest 4 is a child rate3 will be.......
I tried to do a function guest as seen above but it don't work
any thoughts ??