PDA

View Full Version : Dropdown ‘linked’ combo menus


Benjie77
07-26-2012, 05:36 PM
Please could someone help me with dropdown ‘linked’ combo menus?


I am new to web design - I am using Dreamweaver cs6 ( php – mysql database)


I would like a definitive answer as to how I would go about linking the counties to the towns menu, and yes I am aware that the county id’s on the town table are not correct and needs updating.
At present the two sets of information are separate tables – I am not concerned if I need to retype the lot, but I thought this would have been a fairly easy task considering it is something commonly found on web pages, but having done a lot of searching I can’t seem to get ‘one’ sensible answer. I need it in black and white to get my head round it. Also as a little extra, and I’m sure an easy one to resolve the drop downs at present fill my screen when opened – how do I go about shortening the visible list?
Much appreciated

Ben
The two tables:


--
-- Table structure for table `counties`
--

CREATE TABLE IF NOT EXISTS `counties` (
`id` int(20) NOT NULL auto_increment,
`name` varchar(60) NOT NULL default '',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=71 ;

--
-- Dumping data for table `counties`
--

INSERT INTO `counties` (`id`, `name`) VALUES
(1, 'Avon'),
(2, 'Bedfordshire'),
(3, 'Berkshire'),
(4, 'Buckinghamshire'),
(5, 'Cambridgeshire'),
(6, 'Cheshire'),
(7, 'Cleveland'),
(8, 'Cornwall'),
(9, 'County Durham'),
(10, 'Cumbria'),
(11, 'Derbyshire'),
(12, 'Devon'),
(13, 'Dorset'),
(14, 'East Sussex'),
(15, 'Essex'),
(16, 'Gloucestershire'),
(17, 'Hampshire'),
(18, 'Herefordshire'),
(19, 'Hertfordshire'),
(20, 'Isle of Wight'),
(21, 'Kent'),
(22, 'Lancashire'),
(23, 'Leicestershire'),
(24, 'Lincolnshire'),
(25, 'London'),
(26, 'Merseyside'),
(27, 'Middlesex'),
(28, 'Norfolk'),
(29, 'North Humberside'),
(30, 'North Yorkshire'),
(31, 'Northamptonshire'),
(32, 'Northumberland'),
(33, 'Nottinghamshire'),
(34, 'Oxfordshire'),
(35, 'Shropshire'),
(36, 'Somerset'),
(37, 'South Humberside'),
(38, 'South Yorkshire'),
(39, 'Staffordshire'),
(40, 'Suffolk'),
(41, 'Surrey'),
(42, 'Tyne and Wear'),
(43, 'Warwickshire'),
(44, 'West Midlands'),
(45, 'West Sussex'),
(46, 'West Yorkshire'),
(47, 'Wiltshire'),
(48, 'Worcestershire'),
(49, 'Medway'),
(50, 'London (City)'),
(51, 'London (West End)'),
(52, 'London (South East)'),
(53, 'London (West)'),
(54, 'London (South)'),
(55, 'London (North)'),
(56, 'London (East)'),
(57, 'Scotland'),
(58, 'Wales'),
(59, 'Northern Ireland'),
(60, 'Yorkshire'),
(61, 'Jersey'),
(62, 'Guernsey'),
(63, 'Isle of Man'),
(64, 'Sark'),
(65, 'Scottish Islands'),
(66, 'Scotland'),
(67, 'Northern Ireland'),
(68, 'Eire'),
(69, 'Wales'),
(70, 'London (South West)');

-- --------------------------------------------------------

--
-- Table structure for table `towns`
--

CREATE TABLE IF NOT EXISTS `towns` (
`id` int(50) NOT NULL auto_increment,
`county_id` int(50) NOT NULL default '0',
`name` varchar(200) NOT NULL default '',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=84 ;

--
-- Dumping data for table `towns`
--

INSERT INTO `towns` (`id`, `county_id`, `name`) VALUES
(1, 21, 'Ashford'),
(2, 21, 'Broadstairs'),
(3, 21, 'Canterbury'),
(4, 21, 'Chatham'),
(5, 21, 'Dartford'),
(6, 21, 'Deal'),
(7, 21, 'Dover'),
(8, 21, 'Edenbridge'),
(9, 21, 'Faversham'),
(10, 21, 'Folkestone'),
(11, 21, 'Gillingham'),
(12, 21, 'Gravesend'),
(13, 21, 'Herne Bay'),
(14, 21, 'Hythe'),
(15, 21, 'Lydd'),
(16, 21, 'Maidstone'),
(17, 21, 'Margate'),
(18, 21, 'Minster'),
(19, 21, 'New Romney'),
(20, 21, 'Northfleet'),
(21, 21, 'Paddock Wood'),
(22, 21, 'Rainham'),
(23, 21, 'Ramsgate'),
(24, 21, 'Rochester'),
(25, 21, 'Tunbridge Wells'),
(26, 21, 'Sandwich'),
(28, 21, 'Sheerness'),
(29, 21, 'Sittingbourne'),
(30, 21, 'Snodland'),
(31, 21, 'Strood'),
(32, 21, 'Swanley'),
(33, 21, 'Tenterden'),
(34, 21, 'Tonbridge'),
(35, 21, 'West Malling'),
(36, 21, 'Westerham'),
(37, 21, 'Whitstable'),
(38, 21, 'Sevenoaks'),
(40, 21, 'Sandgate'),
(41, 21, 'Bromley'),
(42, 21, 'Orpington'),
(43, 21, 'Biggin Hill'),
(45, 21, 'West Kingsdown'),
(46, 21, 'Bexley Heath'),
(47, 21, 'Welling'),
(48, 21, 'Bexley'),
(49, 21, 'Sidcup'),
(50, 21, 'Foots Cray'),
(51, 21, 'St Mary Cray'),
(52, 21, 'Chelsfield'),
(53, 21, 'Farnborough'),
(54, 21, 'Hildenborough'),
(55, 21, 'Dunton Green'),
(56, 21, 'Riverhead'),
(57, 21, 'Chipstead'),
(58, 21, 'Tatsfield'),
(59, 21, 'Cranbrook'),
(60, 21, 'Hawkhurst'),
(61, 21, 'Rye'),
(62, 21, 'Walmer'),
(63, 21, 'Crowborough'),
(64, 21, 'Wadhurst'),
(65, 21, 'Ticehurst'),
(66, 21, 'Birchington'),
(68, 21, 'Walderslade'),
(69, 21, 'Singlewell'),
(70, 21, 'Greenhythe'),
(71, 21, 'Crayford'),
(72, 21, 'Slade Green'),
(73, 21, 'Erith'),
(74, 21, 'Eltham'),
(75, 21, 'Woolwich'),
(76, 21, 'Greenwich'),
(77, 21, 'Blackheath'),
(78, 21, 'Charlton'),
(79, 21, 'Chislehurst'),
(80, 21, 'Petts Wood'),
(81, 21, 'Bickley'),
(82, 21, 'West Wickham'),
(83, 21, 'Beckenham');

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;