Forum Moderators: coopster
<?
include_once "myconnect.php";
{
?>
<form name="form1" method="post" action="showcategory.php" >
<input name="location" type="text" id="location" value="My City" size="10">
<select name="country" size="1">
<option selected value="">All Countries</option>
<?
$rs_t_query=mysql_query ("select * from mysqldatabse_country order by country");
while ($rs_t=mysql_fetch_array($rs_t_query))
{
?>
<option value="<? echo $rs_t["id"];?>"><? echo $rs_t["country"] ;?></option>
<?
}
?>
</select>
<input type="submit" name="Submit" value="My City">
<input name="show_save" type="hidden" id="show_save" value="yes">
</font></td>
</tr>
</form>
<?
}// end main
?>
>> The idea is to have the customer select the City button of their choice which will take them to information for that city.
ok that makes sense by itself
>> The form works fine, just need to be able to hide the city/country fields
now I lose it, you want them to select them but you don't want them to see them?
>> and be able to enter them in the script for each city/country.
I don't get that part either.
I'm sorry, i want to help I just really don't understand the flow of what you want to do
Customer navigates from index page through country, state, province, region etc. (html)
Once they get to region I want them to have links, buttons whatever for the city of their choice. Once they select a city it will bring back results as the form I posted does from the mysql database.
I thought maybe I could hide the fields, hard code the country/city and display the button or link. Same thing for each city on the page.
The customer can jump right to the end via a link on the homepage but I wanted this as an alternative and to display some information along the way.
Like this:
Click Country (html) => to Province Page
Select Province (html) => to Region Page
Select Region (html) => to Cities for that Region
Cities:
Toronto
Brampton
Kingston ...etc.
Clicking a City would bring back results from mysql as per the form I posted.
Hope that helps and thanks!
if you are using buttons you should be able to have a hidden form field that contains the country info. I don't know where that is accessible though, is it posted? some var somewhere?
this is the general idea
<form name="somename" action="somescript" method="post">
<input type="hidden" name="country" value="<?php echo $countryvar;?>">
<input type="hidden" name="country" value="<?php echo $cityvar;?>">
<input type="submit" value="<?php echo $cityvar;?>">
</form>
then when it is submitted you will have the country and the city available in the $_POST array
that what you mean?
Here's the mysql table. (it's edited down) Canada is Country code 32 and USA is 210. Cities are named. ie: Toronto. I really appreciate the help...
-- --------------------------------------------------------
--
-- Table structure for table `myXXXXXXXdatabse_members`
--
CREATE TABLE `myXXXXXXXdatabse_members` (
`id` bigint(20) NOT NULL auto_increment,
`c_name` varchar(255) collate latin1_general_ci default NULL,
`city` varchar(255) collate latin1_general_ci default NULL,
`state` varchar(255) collate latin1_general_ci default NULL,
`zip` varchar(50) collate latin1_general_ci default NULL,
`country` varchar(255) collate latin1_general_ci default NULL,
`suspended` varchar(255) collate latin1_general_ci default 'no',
`temp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
`signup_on` timestamp NOT NULL default '0000-00-00 00:00:00',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=31 ;
This is how I'm setting the page up:
<?
include_once "myconnect.php";
{
?>
<form name="cities" action="showcategory.php" method="post">
<input type="hidden" name="country" value="<?php echo $countryvar;?>">
<input type="hidden" name="country" value="<?php echo $cityvar;?>">
<input type="submit" value="<?php echo $cityvar;?>">
</form>
<?
}// end main
?>
<input name="location" type="text" id="location" value="My City" size="10">
to:
<input name="location" type="hidden" id="location" value="My City">
and:
<select name="country" size="1"><option selected value="">All Countries</option>
to:
<input name="country" type="hidden" size="1"><option selected value="Country Code Here"></option>
So now when I enter "New York" in the "value="My City""
and for country:
<option selected value="32"></option>
and the button:
<input type="submit" name="Submit" value="New York">
I get a lovely little button showing with nothing else that brings back nothing but posts from New York.
Thank you so much for your time as I learn. You have been very helpful. :-)