Here's what I have so far:
First drop down = select a state (works)
This populates the second drop down (works)
Second drop down = select a city (works)
This populates the third drop down with local restaurant names (not quite)
When I select a restaurant from the drop down the form is submitted but the $rest_name variable isn't carried over
Site: www.abcgreatdeals.com
Select:California, La Quinta for an example
I'm sure it's something simple that I'm just over looking. Thanks for any input.
Code: [Select]<form id="form1" name="form1" method="post" action="<?php echo $PHP_SELF; ?>" enctype="multipart/form-data">
<?php
if (isset ($_POST['state']))
{
if ($state == '99')
{
?>
<script type="text/javascript">
<!--
window.location = "http://www.abcgreatdeals.com"
//-->
</script>
<?php
}
?>
<select name="state" CLASS="formTextbox" onchange="form1.submit();">
<option value="<?=$state;?>"><?=$state;?></option>
<option value="99">Start Over</option>
<?php
}
else{
$Get_State = mysql_query("SELECT DISTINCT state FROM coupons ORDER BY state",$db_link);
?>
<select name="state" CLASS="formTextbox" onchange="this.form.submit();">
<OPTION SELECTED VALUE="">Select A State</OPTION>
<? while($get_it = mysql_fetch_array($Get_State)) { ?>
<option value="<?=$get_it['state'];?>"><?=$get_it['state'];?></option>
<?
}}
if (isset ($_POST['state']))
{?>
</select>
</form>
<form id="form2" name="form2" method="post" action="<?php echo $PHP_SELF; ?>" enctype="multipart/form-data">
<?php
if (isset ($_POST['city']) != '')
{
if ($city == '99')
{
?>
<script type="text/javascript">
<!--
window.location = "http://www.abcgreatdeals.com"
//-->
</script>
<?php
}
?>
<input type="hidden" name="state" value="<?="$state"; ?>">
<select name="city" CLASS="formTextbox" onchange="form2.submit();">
<option value="<?=$city;?>"><?=$city;?></option>
<option value="99">Start Over</option>
<?php
}
else{
$Got_City = mysql_query("SELECT DISTINCT city FROM coupons WHERE state='$state' ORDER BY city",$db_link);
?>
<input type="hidden" name="state" value="<?="$state"; ?>">
<select name="city" CLASS="formTextbox" onchange="form2.submit();">
<OPTION SELECTED VALUE="">Select A City</OPTION>
<? while($got_it = mysql_fetch_array($Got_City)) { ?>
<?
if ($got_it['city'] != ''){ ?>
<option value="<?=$got_it['city'];?>"><?=$got_it['city'];?></option>
<?
}
else { ?>
<option value="99">Start Over</option>
<? } ?>
<?
}}
if (isset ($_POST['city']))
{?>
</select>
</form>
<form id="form3" name="form3" method="post" action="<?php echo $PHP_SELF; ?>" enctype="multipart/form-data">
<?php
if (isset ($_POST['rest']) != '')
{
if ($rest == '99')
{
?>
<script type="text/javascript">
<!--
window.location = "http://www.abcgreatdeals.com"
//-->
</script>
<?php
}
?>
<input type="hidden" name="city" value="<?="$city"; ?>">
<input type="hidden" name="state" value="<?="$state"; ?>">
<select name="rest" CLASS="formTextbox" onchange="form3.submit();">
<option value="<?=$rest_name;?>"><?=$rest_name?></option>
<option value="99">Start Over</option>
<?php
}
else{
$Get_Rest = mysql_query("SELECT DISTINCT rest_name FROM coupons WHERE state='$state' AND city='$city'",$db_link);
?>
<input type="hidden" name="state" value="<?=$state?>">
<input type="hidden" name="city" value="<?=$city?>">
<select name="rest" CLASS="formTextbox" onchange="form3.submit();">
<OPTION SELECTED VALUE="">Select A Restaurant</OPTION>
<?
while($got_rest = mysql_fetch_array($Get_Rest)){
$rest_name = stripslashes($got_rest['rest_name']);
?>
<option value="<?=$rest_name;?>"><?=$rest_name?></option>
<?
}}}}
if (isset ($_POST['rest']))
{?>
</select>
</form>
<?php
if ($rest_name){
echo "<strong>Click on coupons to print individually</strong>
";
}
if ($rest_name)
{
$Get_Coupons = mysql_query("SELECT * FROM coupons WHERE rest_name='$rest_name' ORDER BY coupon_rank DESC",$db_link);
SQl num_rows problem
when i try to count rows from an SQL select i get an warningCode: [Select]$countviews = mysql_query("SELECT * FROM viewed WHERE sfw = '0' AND cookieid = $id");$num_rows_viewed =
retrieving more than one max key from an array?
so i have an array of 20 numerical values (0-100) that i need to order from highest to lowest and then i need to retrieve the keys of the top ten values. $array1 =
header redirect problems? please help
Ok i am making a site that generates youtube thumbnails and i am generating an image that displays 1 image with a playbutton image on top of ithere is the page that generates the
SAP Treasury - Commodities
We are running SAP ECC 6.0 with Treasury Activated.
How many users online in the last 24-hours using time()?
I'm fairly new to PHP. I have a MySQL table called 'users' and a field called 'loggedin' which is in time() format.I need a query that'll check how many players have logged in within the last
how to remove in php string display
My code is$message="We're looking at developing our website.";$body= "My message is,\n\n\n\n\t\t\t".$message";echo $body;I get result We\'re looking at developing our
apart from cron
I need to run a php file every one hour. Is there any other solution apart from cron job?
Day of week
I am using PHP version 5.0.5I have a varaible ($DATE (date format yyyy-mm-dd)) that is being incremented to populate a table with each day of the month. I am then trying to get the day of week
MySQL issue
I am taking sentences through a form on page. Then checking some condition and trying to insert them in database. I have issues while inserting...foreach ($sentences as $final) {......else {
Login script (probably a simple error)
dbConfig.phpCode: <?// Replace the variable values below// with your specific database information.$host = "localhost";$user = "username";$pass = "password";$db