Jump to content

Recommended Posts

Hi there

 

I am trying to create a search form to retrive rates form multiple selections and then display the results.

 

i have created the database in mysql

 

database name: Rates

 

in that there are the following 6 tables:-

 

1.Country

2.Area

3.Region

4.destination

5.airline

6.rate_table

 

1)The country has the following columns:-

 

Country_code,Country_name,Area and Region

 

2)The Area table has the following columns:-

 

Area_code,Area name and Country

 

3)The Region table has the following coulumns:-

 

Region_Code,Region_Name and Country

 

4)The destination has the following columns:-

 

Dest_Code,Dest_Name and Dest_Country

 

5. The Airline Table has the following columns:-

 

Airline_Code and Airline_Name

 

6) The Rates Table has the following columns:-

 

Rate_ID,Rate_Airline,Rate_Destination and Rate

 

 

I managed to create my first drop down using the code below:-

 

<?php
//create connection
$connectmysql=mysql_connect("localhost","root","root");


if (!$connectmysql) {
die('Not Connected :' . mysql_error());

}


$db_selected=mysql_select_db('rates',$connectmysql);
?>

<?php

$result = mysql_query("SELECT Country_Name FROM Country ORDER BY Country_Name") or die(mysql_error());
while ($row=mysql_fetch_array($result)) {
$Country_Name=$row["Country_Name"];

$options.='<option value="'.$row['Country_Name'].'">'.$row['Country_Name'].'</option>';
};

?>


<html>


<body>


<SELECT NAME=catid>
<OPTION VALUE=0>choose</option>

<?php echo $options;?>
</SELECT>


</HTML>
 

the stucture plannned is

 

country-->region--->Area--->destination--->Airline  and then search.

 

 if the country is selected then the next drop down should show the region automatically in the next dropdown and for the area drop down.The destination drop down should only show destinations for the county selected and the airline should only show the list of airlines.

 

then the rate results should show based on these cliterias.

 


Thanks and Regards

 

Keith

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/279107-help-in-creating-a-search-form/
Share on other sites

 


the stucture plannned is

 

country-->region--->Area--->destination--->Airline

 

Your data tables do not reflect that structure, it is more like

country--+--> area
         |
         +--> region
         |
         +--> destination ----> rates <----- airline
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.