Ajax Triple Dropdown With Country - Region - Cities?

Ajax triple drop-down with country-region-cities, all of the 3 drop down menu will got their value form 3 different tables on one db,vthe third drop down is based on the second selection,and also the second one is base on the first one and the problem with the code i have is: there is $val which will keep what is selected,unfortunately $val will just keep the selection of the first drop down,i mean country is the first one so if the choice is usa the $val will be usa,but i want to have each drop down menu selection in separate variable,

i attached the code
Attached File(s)
a.php (1.24K)
Number of downloads: 186
b.php (1.54K)
Number of downloads: 171


Dropdown With Ajax / Get List Of Cities Populated From The Database But Getting A Blank Dropdown?

For some time i am battling to solve this problem but iam not coming to any conclusion so thought to seek some help here. The problem is that i am getting a blank dropdown instead i should get list of cities populated from the database. Database connection is fine but iam not getting anything in my dropdown.

This is what iam doing:


require 'includes/connect.php'; - database connection
$country=$_REQUEST['country']; - get from form (index.php)
$q = "SELECT city FROM city where countryid=".$country;
$result = $mysqli->query($q) or die(mysqli_error($mysqli));
if ($result) {
<select name="city">
<option>Select City</option>
$id = 0;
<?php while ($row = $result->fetch_object()) {
$src = $row->city;
$id = $id + 1;
<option value= <?php $id ?> > <?php $src ?></option>
<?php } ?>
<?php } ?>

ajax script is this:

function getXMLHTTP() { //fuction to return the xml http object
var xmlhttp=false;
try{mlhttp=new XMLHttpRequest();}
try{ xmlhttp= new ActiveXObject("Microsoft.XMLHTTP"); }
catch(e){ try{
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
return xmlhttp;
function getCity(strURL) {
var req = getXMLHTTP();
if (req) {
req.onreadystatechange = function() {
if (req.readyState == 4) {
if (req.status == 200) {
} else {
alert("There was a problem while using XMLHTTP:
" + req.statusText);
req.open("GET", strURL, true);

This is my form code:

<form method="post" action="" name="form1">
<table width="60%" border="0" cellspacing="0" cellpadding="0">
<td width="150">Country</td>
<td width="150"><select name="country" onChange="getCity('findcity.php?country='+this.value)">
<option value="">Select Country</option>
<option value="1">New Zealand</option>
<option value="2">Canada</option>
<tr style="">
<td ><div id="citydiv"><select name="city">
<option>Select City</option>

View 2 Replies View Related

Social Engine Zend Framework - Dynamic Ajax Dropdown For Country / State / City?

I am working with Social Engine which is based on Zend Framework and Smarty Templates. I need to make custom functionality for profile page, where I need Ajax based Dynamic Country / State / City selections like

Dropdown for Country -> on selection of some country, State will display belonging to selected country and State selection -> related Cities will display. I have separate tables for my country/state and city.

can provide some reference / examples for the same? I don't know, how to make Ajax calls and render my views with this !

View 2 Replies View Related

Automatically Populate Cities With Respect To Selected Country?

I am trying to extend shipping method with respect to cities.

When i select country in flat rate, Automatically populate cities with respect to selected country.

How may i change or extend shipping method

View 2 Replies View Related

Populate Country / Region Names At DB Or Application Level?

My website would have a list of countries in dropdown list and list of cities based on chosen country. I decided to populate the list at db level as:

countryID - PK
countryName - FK


cityName gets inserted directly without us having to join or call multiple tables and get specific ID for a city so we can then grab the cityName, etc...

I will only normalize in crucial tables such as making relationships between Member and Post/Thread tables. A member can have multiple threads one-to-many relationship. Otherwise, things that relate to multi-value as countries list won't be considered at DB level for simplicity and rap sake.

View 3 Replies View Related

Populate A Dropdown List Of All Unique Cities From A Table In Database?

I am trying to populate a dropdown list of all unique cities from a table in my database. Some users have the same city and when I populate the dropdown list, I get cities multiple times. This is not what I want. Just once is enough.

Here is what I have...

$query = mysql_query("SELECT city FROM users");
echo "City <select name='city'>";
while ($row=mysql_fetch_array($query))
if ($row['city']) some users do not have a city


View 4 Replies View Related

Loading Cities Combo Using AJAX And It

I am trying to load city combo using AJAX and PHP.....but its showing nothing... This is AJAX

HTML Code:
// JavaScript Document
// JavaScript Document
var xmlHttp
// Start of loading Constituency //
function loadcity(state_search)
var value=document.getElementById('inpstate').value;
//var lang=document.getElementById("language").value;

View 1 Replies View Related

Dropdown Selected Value From Database / Display Selected Value Of Country Dropdown List As Value Saved In Db?

In edit profile form I want to display selected value of Country dropdown list as value saved in db and user can change that also.

View 4 Replies View Related

Select Country From Dropdown From Saved Search

I have a search form where users can search by age and country. Users can also save their search so they can go back and do it again but the problem is when they reload their saved search, I need it to select the country that has been saved in the drop down. So if someone searched the United Kingdom, I need it to show United Kingdom in the select drop down instead of (Select Country). Is there any easy and quick way around this?

View 3 Replies View Related

HTML Show Dropdown Of Country Calling Codes?

I need to show a dropdown menu with the international calling codes for each country. Where can I find such a drop down????

View 5 Replies View Related

Pick A Country Dropdown Selection Form Item Without Using Database?

I have this PHP code that I use to make a dropdown form selection of country'sI would like to eliminate this extra mysql query though and just store the output like in code to on the pageHowever I am lost on how I would have the users country SELECTED If I do not use the query to get the data

<select name="country" style="width:180px;" onChange="do_get_rest_popup(this.value)" o>
$sql="SELECT * FROM users_countries ORDER BY country";


View 3 Replies View Related

Make Timezone Dropdown List Populate With Available Timezones On A Per Country Basis?

I just noticed something really nice on the Google Analytics signup page for adding a new domain. First you pick a country them you pick your timezone. Instead of showing a huge Timezone list though they populate the timezone list with only timezones that are available for the country you have selected. I think this is a great idea to make picking a timezone easiar for some users.

So I would like to do this with jQuery since most my other javascript is using jquery already. Has anyone seen any existing jquery script that can do this for me? Or possibly how I can figure out what timezones are in each country?

View 2 Replies View Related

Select A Region From A Picture And Blur The Selected Region And Make It Watermarked ?

I tried a lot but cannot find it out.. I have found watermarked script. But i did n't find a script where i can select a region from a picture and blur it..

I am using PHP Script for that.

View 1 Replies View Related

Form Country List - Recording The Users Country To The Database

I am making a very simple form which will input information into a mysql database to make a user account. However, I am having difficulty in recording the users country to the database. I am using the following code to generate a drop down list for country selection. -

<select><option value=" " selected>(please select a country)</option><option value="--">none</option><option value="AF">Afghanistan</option><option value="AL">Albania</option><option value="DZ">Algeria</option>etc etc

how to record the user's selection to a table in my database, as google searches have proven to be a little daunting!

View 5 Replies View Related

Calling Dropdown Through Ajax?

i want to show dropdown box calling from another dropdown. when one is selected, another dropdown will be called from database values. i am using this code :

echo $fginfo=" <td width='150' class='label'>Items</td>
<td class='content' colspan='3'>
<select name='item_code' id='item_code' onchange='checkitemcode();'>
<option value='0'>Select Item</option>".


but the values from the database are not seen.

View 1 Replies View Related

Using AJAX To Populate Dropdown Menu?

I want to allow users to update a school dropdown menu without the page refreshing. The schools would be added to MySql and then retrieved using PHP and AJAX to populate the menu.

Here is what the HTML would look like:

HTML4Strict Code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title>Untitled Document</title><script type="text/javascript" language="javascript">function populate(){if (document.form1.select.value !=


View 6 Replies View Related

Filtering Dropdown Menu's With Ajax ?

I have a CodeIgniter MVC application. I have a model called city that has a method:

class Cities_model extends Model{
function Cities_model(){
function get_cities($id = null){
$this->db->select('id, city_name');


So it is successfully retriving the correct data. the only problem is it's adding blank values/text to the drop down. and each time I change the city the data is being added on, so I guess i'd have to clear the dropdown first?

View 2 Replies View Related

Populate Multiple Dropdown From DB Using AJAX?

I am working on a car portal and having a problem in populating multiple dropdown from database using PHP and AJAX. For example,I have 1st drop down of CAR MAKE which has 3 car companies names (Filled from databse)

1. Toyota

2. Honda

3. Nissan

Then I have another dropdown which which will populate on selecting the above described CAR MAKE dropdown.

1. Corolla (for Toyota)

2. Civic (for Honda)

3. Skyline (for Nissan)

(e.g If I select Toyota then automatically in the next dropdown corolla will appear and so on)

Then I have another dropdown by the name of PRICE which will have car price (e.g Min price 10,000 to Max 100,000,000)And at last I have a search button which will take me to the search page of my selected values in the above 3 dropdowns and will show a list of cars from database.

View 2 Replies View Related

Triple Menu

I'm going to have a website that will have a very dynamic menu structure (one that could change every few minutes) and it is essential that everytime the menu is built, the updated database entries are included.

Background:  The site is a homework study site that gives study tools, etc.  So lets say that i want to look up the Math (subject or "class"), Pre-Algebra ("course"), CPM ("curriculum"), i would first select Math in the first drop down menu, then Pre-Algebra in the second, and then CPM in the third.  In the second and Third boxes however, there will be other courses and curriculums to choose from.  Those will be updated very regularly and i do not want to do this manually. Code:

View 1 Replies View Related

Triple Form

I'm writing a single page form which gives the user the options to add, edit, or delete items from a database table. I wish to have this page post to itself, and have all the three options in the one form.

View 2 Replies View Related

Encryption Using Triple DES

currently i am working on a project where we are encrypting a string using triple DES. this encrypted is used for decryting in VC++(this is done by the client) can anyone tell me different ways of performing triple DES encryption.

View 4 Replies View Related

Hide Current Country From A Country Selector

We have multiple Wordpress sites running on the same framework/markup with the exact same functions to simplify updates. Now I want to add a country selector where all sites are added manually in a template file. BUT, I want the current country flag hidden.

Code sample:......................

I'm thinking of a solution based on the site title: bloginfo(name); If the current site title is "Name 2" and "Name 2" exists in the "makeItem list", it get's removed. Is that possible?

View 1 Replies View Related

6 Dropdown Boxes Populated From It / MySQL Using Ajax

i want to use a dropdown box to populate another dropdownbox and so on but i want to maitain all the data adt was selected from d previoce box and i dnt want to make use of submit button but the dropdown must triger the changes assoon as its value gange

View 41 Replies View Related

Jquery - Ajax Dropdown Table Sorting?

I have a page which has a dropdown box. On selection a value is sent to a php script (Ajax), based on the value a html table is created and sent back to the responseText. The table is output to the HTML page.I want the table to have sortable columns, so I have used jQuery datatables for this, but it is not working.I have cut and pasted the exact table into the html and ran the page, and then sorting works.

Note the table output from the php is outputted inbetween:

<a div id="txtHint"> <table id="example"> <div>

Here is the rest of the code on the HTML page:

<script type="text/javascript" src="/js/jquery-1.5.1.js"></script>
<script type="text/javascript" src="/js/jquery.dataTables.js"></script>
<script type="text/javascript" charset="utf-8">[code]....

View 1 Replies View Related

RDF Triple Visualizer - ARC2?

any good software for visualising an rdf triple store as an actual graph? I am using an arc2 triplestore and have already tried the visualizer plug in that is available from semasols site but I cant get it to work: I keep getting theis error: XML Parsing Error: no element found Location:

data:image/svg+xml;base64, Line Number 1, Column 1: I think that the software (Graphviz) isnt linking up with the store somehow but cant work it out. I would have assumed that there would be some sort of api that you could use for this sort of thing but I cant find anything.

View 1 Replies View Related

Call AJAX Request On Dropdown Change Event ?

<script type="text/javascript" src="jquery-1.4.2.js"></script>
<script type="text/javascript" src="ajax.js"></script>

Above code is working perfectly. When I click link 'One' then String 'One' is loaded into workspace DIV and when I click link 'Two' then String 'Two' is loaded into workspace DIV.Question:Now I want to use a dropdown to load one.php and two.php in workspace DIV instead of links in index.php. When I use link then I use class='ajax' in link properties but how to call ajax request on drop down change event ?

View 2 Replies View Related

Jquery - Changing Dropdown List Values Using Ajax?

Populating dropdown - PHP Ajax MySQL

I have 4 dropdown list elements and they should be combined with each other, its about destinations. the first one should have all destinations and then depending on what the user selects the second dropdown list with have the values(destinations) that are available for the selected city, then the 2 other dropdown lists will have the opposite way of that destination. its something like the form in this web site: [URL] (you can see the example in the left side there is a bookig form). I need the ajax script to do this. I will take care of the PHP task.

<div class="WraperForForm">
<form action="index.php?menu=rezervimet&submenu=rezervo" method="post">
<table cellspacing="5" cellpadding="0" border="0" >
<td width="100">


this is part of the code, when I started it I forgot that people will be able to make reservation from cities near them or from abroad, so I made the FROM dropdown only with the domestic cities and the TO dropdown list with foreign cities. anyway I need all this with ajax because I am not good at all with ajax!

View 3 Replies View Related

Make Dynamic Dropdown Lists Using It / MySQL / AJAX

I am trying to make three dynamic drop down lists. When I say dynamic I mean when I choose a value from the first one, the second one changes options and when I choose a value from the second one then the third one changes options. But at the end I want the to keep the selected values because I will submit them. For example the first list may be Country, the second one may be City and the third one Postal Code.

So once I choose country I want the cities in that country to be visible and again once I choose city I want postal code to be visible, buy I do not want to loose my selections every time because I will submit them at the end. I was able to make it up to two drop down menus and it works perfect, but once I add the third everything is destroyed.

<!doctype html public "-//w3c//dtd html 3.2//en">  
<title>Multiple drop down list box from plus2net</title>
<SCRIPT language=JavaScript>
function reload(form)

View 2 Replies View Related

Give Triple Value To A Single Column?

I have 3 drop downs the user can only selected one of them but no matter which drop down user select it has to be inserted into same same field on the database which is field select3 usually is Quote:

$select3 = $_POST['select3'];
i tried to change to
$select3 = $_POST['select1 && select2 && select3'];
and the insert
$query="INSERT INTO photos values ('$select3')";


View 10 Replies View Related

Auto Populate Triple Drop Down Box

I'm trying to create an ad section on a member website so people can post daily ads like craigslist. but I'm having trouble with the location selection. I found this tutorial online (in the javascript and php below). It autopopulates three drop down boxes based on the country, then state, then city, all from the database tables (country, state, city)...

It works great for populating the dropdown boxes BUT I can't figure out how to take the Country Value from the Form, and the 2 strings retrieved from the DB (Like USA, California, Los Angeles) and put them into my db "dailyads" table (in to the respective fields of course - country, state, city)??


View 6 Replies View Related

Jquery Ajax - On Change Of Dropdown List Showld Call The Function?

On change of the dropdown list, A php function should called.Inside the PHP function I will do some calculation. Later I need to set the value of a text box or else that PHP function should return a value that value shoul be catch in the javascript and set that valu to the textbox control.My html function is nd in PHP function is placed in D:/Project/EmployeeDetails/EmpLeave.php

class clsGetTotalPL
function GetTotalPL($EmployeeId)


View 2 Replies View Related

Copyrights 2005-15 www.BigResource.com, All rights reserved