Once a user selects a state it will load all information listed in the ROWS of the state column I.E.
++++++++++++++++
+ Select Your State + Pulls from column “state” say they pick California
++++++++++++++++
Anything in the database with California in that column will then begin to display the rows.
Company Name:
Address:
City:
State abbreviation:
Zip:
Phone:
Website:
The database is set up like this
State company address city stateabb zip etc...
California Test Company 123 St. Test CA 99999
California Test Company 123 St. Test CA 99999
California Test Company 123 St. Test CA 99999
================================================== ======
So that is what the data file looks like and once they clicked on a state it will find all that match what they picked and display what ever rows I would list.
Displaying the rows is easy I just need help with the quey and the click on the state and it will search it and load whatever columns I tell it do that match with the state.
Any help would be great!!!
Here is something I tryed and its not working.
Expand|Select|Wrap|Line Numbers
- <head>
- <script type="text/javascript">
- var div7 = '<p> </p>';
- var ajax = new sack();
- var selstate;
- function buildtop() {
- ajax.requestFile = 'getCarInfo.php?buildtop=1';
- ajax.onCompletion = makeTop;
- ajax.runAJAX();
- }
- function getPart(sel) {
- selstate = sel.options[sel.selectedIndex].value;
- if(selYear.length>0){
- ajax.requestFile = 'getCarInfo.php?getpart=1&state='+selstae+';
- ajax.onCompletion = createPart;
- ajax.runAJAX();
- }
- }
- </script>
- </head>
- <?php
- // =========================================================
- // Populate the State selection list from the database
- // =========================================================
- echo '<form action="" method="post">';
- echo '<select id="state" name="state" style="margin-bottom:4px;font-family: Tahoma; font-size: 10pt; height:28px;width:184px;" onchange="getList(this)">';
- echo '<option value="">Select Your State</option>';
- // =========================================================
- // Connection to the Database
- // =========================================================
- include ('db functions/db_connect.php');
- // =========================================================
- // SELECT year to make drop down list
- // =========================================================
- $res = mysql_query("SELECT state FROM dealerlocater WHERE 'state' GROUP BY state ORDER BY state")
- or die("Invalid query: " . mysql_query());
- while ($row = mysql_fetch_assoc($res)) {
- $st = $row['state'];
- echo "<option value='$st'>$st</option>";
- }
- echo '</select>';
- ?>
- <DIV ID="divmsg7">
- </DIV>
If not I will need the help with the ajax...
Thank you
Chris