This is really a JavaScript problem if you don't want to use the submit
button.

Use PHP to load the values of both tables into a JavaScript array.  Then
write JS code that will change the contents of the City control based on
what is selected in the country control.  Not terribly difficult.

Cal
http://www.calevans.com


-----Original Message-----
From: Adrian D'Costa [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 06, 2001 12:01 AM
To: [EMAIL PROTECTED]
Subject: MySQL and PHP Question


Hi,

I have two tables city and country
+-----------+-------------+------+-----+---------+----------------+
| Field     | Type        | Null | Key | Default | Extra          |
+-----------+-------------+------+-----+---------+----------------+
| id        | int(5)      |      | PRI | 0       | auto_increment |
| city      | varchar(35) |      | MUL |         |                |
| countryid | int(5)      |      | MUL | 0       |                |
+-----------+-------------+------+-----+---------+----------------+
3 rows in set (0.00 sec)

mysql> desc country;
+---------+-------------+------+-----+---------+----------------+
| Field   | Type        | Null | Key | Default | Extra          |
+---------+-------------+------+-----+---------+----------------+
| id      | int(5)      |      | PRI | 0       | auto_increment |
| country | varchar(35) |      | MUL |         |                |
+---------+-------------+------+-----+---------+----------------+
2 rows in set (0.00 sec)

I am trying to write a php script that does the following.
In an html page I have two dropdowns one country which will get the data
from the country table and city which should get the data from the city
table based on the one selected from the country drop down.  I do not want
to use a submit button.  I use a javascript and using onChange pass the
country.id to the javascript but do not know how to pass it back to the
php script.  Any pointers

Adrian

--
===================
Adrian D'Costa
[EMAIL PROTECTED]
www.pcsadvt.com
===================


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to