473,378 Members | 1,482 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

select box query

110 100+
i have two seelct boxes in one row as below
[HTML]</form>
<table>
<tr><td>
<select name="countrycode" id="countrycode" onchange="showcountrycode
(this.value);">
<option selected>select country</option>
</select>
<p>ths option are fille dhere fromt eh mysql table using query</p>
</td>
<td>
<select name="citycode" id="citycode" onchange="showcity(this.value);">
<option selected>select city</option>
</select>
</td>
</tr>
</table>
</form>[/HTML]
i have seen some examples using ajax but the options are defines there i want to use $countrycode to fetch cities from the city mysql table


Thanks
Dec 26 '07 #1
3 2584
i have two seelct boxes in one row as below
[HTML]</form>
<table>
<tr><td>
<select name="countrycode" id="countrycode" onchange="showcountrycode
(this.value);">
<option selected>select country</option>
</select>
<p>ths option are fille dhere fromt eh mysql table using query</p>
</td>
<td>
<select name="citycode" id="citycode" onchange="showcity(this.value);">
<option selected>select city</option>
</select>
</td>
</tr>
</table>
</form>[/HTML]
i have seen some examples using ajax but the options are defines there i want to use $countrycode to fetch cities from the city mysql table


Thanks
Hi,
Do you want that the name and id of the select boxes should be a variable $countrycode and the value assigned to it should be fetched from table.

Thanks!
:)
Dec 26 '07 #2
dmjpro
2,476 2GB
i have two seelct boxes in one row as below
[HTML]</form>
<table>
<tr><td>
<select name="countrycode" id="countrycode" onchange="showcountrycode
(this.value);">
<option selected>select country</option>
</select>
<p>ths option are fille dhere fromt eh mysql table using query</p>
</td>
<td>
<select name="citycode" id="citycode" onchange="showcity(this.value);">
<option selected>select city</option>
</select>
</td>
</tr>
</table>
</form>[/HTML]
i have seen some examples using ajax but the options are defines there i want to use $countrycode to fetch cities from the city mysql table


Thanks
Which Server Side scripting you are using.
If that is Java based then I can help other wise I can't.
If you want to get those values while the page gets processed on Server Side then it can be done simply using Server Side Scripting.
But if you want to get those information after the page loaded then you have to use Ajax.

Debasis Jana
Dec 26 '07 #3
SSG001
110 100+
i will select countrycode from select box and post this value using ajax ,php,javascript now this values is stored in $countrycode so while fetching the data for cities i'll use this to build query.

actually i have a main form on which both the select boxes are given and the country is filled with mysql country table
now i have used ajax and javascript to post this value without refreshing as i have n number of rows of this type and i can't aford let it refresh after evry rows country code is selected .
which is passed to country.js file through showcountry function
and from there to country.php to fetch the record for country details depending upon country code and display it .here i also want that depending upon the country code i want the city select box to be filled along with country details display


[HTML]</form>
<table>
<tr><td>
<select name="countrycode" id="countrycode" onchange="showcountrycode
(this.value);">
<option selected>select country</option>
</select>
</td>
<td><input type="text" name="countryname" id="countryname" ></td>
<td><input type="text" name="env" id="env" ></td>
<td>
<select name="citycode" id="citycode" onchange="showcity(this.value);">
<option selected>select city</option>
</select>
</td>
</tr>
</table>
<table align="center"><tr>
<td colspan="5"><input type ='button' value='add row' name='addrow' id="addrow" onClick='add_rows(document.getElementById("tbl1"), this.id);'></td>
</tr></table>
</form>[/HTML]

//my country.js file
Expand|Select|Wrap|Line Numbers
  1. function addrow(tbl,tb){
  2. }
  3.  
  4.  
  5. function showcountrycode(code)
  6. {
  7. //to pass  code to country.php
  8. }
  9.  
  10.  
  11. }
//country.php
[PHP]$countrycode=$_GET['code'];
//1.select query to fetch details from country table using countrycode
//2.select query to fetch cities from city table using countrycode
//and fill the records in the select box
echo $countryname"|".$env
//i have managed to display country name after assiging xmlresponse split value from javascript country.js bt don't know to how to do select box value filling [/PHP]
Dec 27 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Phil Powell | last post by:
Here is the scope of what I need to do; want: enrollment_year allowed (even if null) all of ica criteria:
21
by: John Fabiani | last post by:
Hi, I'm a newbie and I'm attempting to learn howto create a select statement. When I use >>> string1='18 Tadlock Place' >>> cursor.execute("SELECT * FROM mytest where address = %s",string1) All...
4
by: jimh | last post by:
I'm not a SQL expert. I want to be able to write a stored procedure that will return 'people who bought this product also bought this...'. I have a user table that links to a transaction table...
3
by: Tcs | last post by:
My backend is DB2 on our AS/400. While I do HAVE DB2 PE for my PC, I haven't loaded it yet. I'm still using MS Access. And no, I don't believe this is an Access question. (But who knows? I...
1
by: Andrew McNab | last post by:
Hi folks, I have a problem with an MS Access SQL query which is being used in an Access Report, and am wondering if anyone can help. Basically, my query (shown below) gets some records from a...
2
by: Pavel Stehule | last post by:
Hello, Pg make query 1. and 2. very fast (use index), but for query 3. dont use index. I can solve its using select union, but I readed so pg 7.5 don't problem with OR operator. I use cvs pg. I...
2
by: marco | last post by:
Dear List, as it seems, MS SQL as used in Access does not allow a select INTO within a UNION query. Also, it seems that a UNION query can not be used as a subquery. Maybe my (simplified)...
6
by: jjturon | last post by:
Can anyone help me?? I am trying to pass a Select Query variable to a table using Dlookup and return the value to same select query but to another field. Ex. SalesManID ...
0
by: djflow | last post by:
Hi! II was wondering if you can help me with SQL query.. Below 7 separated select query works fine(only when they are retrieved separately) But I want to combined them together and so that i...
22
by: Rickster66 | last post by:
As Instructed this is a new thread regarding my original post: "Select Only 10 Columns Going Back" I'm sorry for the late response. I've been gathering up information and carefully with as much...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.