Click here to Skip to main content
14,843,450 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,
i am making a database, i have 5 tables:
USER:
userid (PK)
password
name
PROYECT:
projectid (PK)
userid (FK)
COUNTRY:
countryid (PK)
projectid (FK)
STATE:
stateid (PK)
countryid (FK)
CITY:
cityid (PK)
stateid (FK)
i have a php web, i have 4 drop down menu, the first one has to show me the proyects, dependeding on the project i have choosen,
the second drop down menu has to show me the countries that have been assigned to that project, depending on the country i have choosen,
the third drop down menu has to show me the states assigned to that country, depending on the state i have choosen
the third drop down menu has to show me the cities assigned to that state.
if you know how i can do this or you have a manual please provide it to me, THANKS!!!!!!
xml
require('conn.php');
sql="SELECT proyectid FROM proyect";
$result=mysql_query($sql);
$options="";
while ($row=mysql_fetch_array($result)) {
$id=$row["id"];
$menu=$row["menu"];
$options.="<OPTION VALUE=\"$id\">".$menu;
}
?>
<SELECT NAME=menu>
<OPTION VALUE=0>Choose
<?php $options ?>
</SELECT>
Posted

1 solution

Better to use Ajax. Once project selected query the countries by the FK, get the result as a formatted string (may be JSON). Fill the Countries combo using javascript..and so on.

Do need the complete coding here?
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900