473,385 Members | 1,597 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,385 software developers and data experts.

second select of dynamic box

hello friends i hava a code like this and could any body help me with editing code and send me code. i am getting city values but i can't location values of city from database.thanks in advance. <html>
Expand|Select|Wrap|Line Numbers
  1. <head>
  2. <title>demo</title>
  3. <body>
  4. <form method="POST" action="http://localhost/vtigercrm/modules/Webforms/
  5. post.php">
  6.  <input type="hidden" value="Leads" name="moduleName" />
  7.  <table>
  8.   <tbody>
  9.    <tr>
  10.       <td><label>Last Name</label></td>
  11.       <td><input type="text" name="lastname" value="" /></td>
  12.    </tr>
  13.    <tr>
  14.       <td><label>First Name</label></td>
  15.       <td><input type="text" name="firstname" value="" /></td>
  16.    </tr>
  17.    <tr>
  18.       <td><label>Company</label></td>
  19.       <td><input type="text" name="company" value="" /></td>
  20.    </tr>
  21.    <tr>
  22.       <td><label>email</label></td>
  23.       <td><input type="text" name="email" value="" /></td>
  24.    </tr>
  25.    <tr><td><label>city</label></td><td colspan=1>
  26.        <select name="city">
  27.         <option>city</option>
  28. <?php
  29. $connect=mysql_connect("localhost","root","venkataz");
  30. if(!$connect) die("access failed");
  31. $select=mysql_select_db("vtigercrm530");
  32. if(!$select) die("select failed");
  33. echo "selected vtigercrm530";
  34. $query="SELECT DISTINCT address_city FROM vtiger_users";
  35. $result=mysql_query($query);
  36. if(!$result) die("database access failed:" . mysql_error());
  37. while($row = mysql_fetch_array($result))
  38. {
  39.   echo "<option value>".$row['address_city']."</option>";
  40. }
  41. ?>
  42. </select>
  43. </tr>
  44. <tr><td><label>lane</label></td><td colspan=1>
  45. <select id="lane" onselect="show();">
  46. <option>location</option>
  47. <script type="text/javascript">
  48. function show()
  49. {
  50. var lane=document.getElementById["lane"].selectedIndex;
  51. alert(lane);
  52. }
  53. </script>
  54. <?php
  55. $connect1=mysql_connect("localhost","root","venkataz");
  56. if(!$connect1) die("access failed");
  57. $select1=mysql_select_db("vtigercrm530");
  58. if(!$select1) die("select failed");
  59. echo "";
  60. echo "<br/>";
  61. $query1="SELECT address_city FROM vtiger_users";
  62. $result1=mysql_query($query1);
  63. if(!$result1) die("database access failed:" . mysql_error());
  64. $lcity=$_REQUEST["city"];
  65. $rows=mysql_num_rows($result1);
  66. for($j=0;$j<$rows;$j++)
  67. if(mysql_result($result1,$j,"address_city")==$lcity)
  68. {
  69.  $query2="SELECT address_street FROM vtiger_users WHERE address_city='".mysql_result($result1,$j,'address_city')."'";
  70. $result2=mysql_query($query2);
  71. while($row= mysql_fetch_array($result2))
  72.  {
  73. echo "<option value>".$row['address_street']."</option>";
  74.  }
  75. }
  76. ?>
  77. </select>
  78. </td></tr>
  79.   </tbody>
  80.  <table>
  81.  <input type="submit" value="Submit" />
  82. </form>
  83. </body>
  84. </head>
  85. </html>
Apr 20 '12 #1
1 1298
Stewart Ross
2,545 Expert Mod 2GB
What's your question? You have not told us so far.
Apr 21 '12 #2

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

Similar topics

5
by: eddie wang | last post by:
hello, I have the following query. it returns result in less than 1 second. select * from employee e, address a where e.id=a.emp_id and e.id=1234 The problem is that it becomes extremely slow...
3
by: Alexandre Laplante | last post by:
Est-il possible en javascript de modifier les OPTION d'une balise SELECT a partir d'un autre..? Donc la selection d'un premier choix changera la liste du deuxieme. Merci Alex... Is this...
2
by: abs | last post by:
Hello everybody. A piece of html code: <form ... > <select ....> <option .... <option .... </select> <select ....>
1
by: bpforte | last post by:
Hello, I need help with building query, basically I need to select all records from one table that don't exists in second table with status 1, but they can exists in second table with status 0, to...
4
by: rn5a | last post by:
A Form has 2 select lists. The 1st one whose size is 5 (meaning 5 options are shown at any given time) allows multiple selection whereas the 2nd one allows only 1 option to be selected at a time. ...
1
by: airwinx | last post by:
Hi all, i am new to javascript and would like to learn more. I face some problem in select box option. I am a php and mysql programmer but come javascript I am idiot. I need some solution: I am...
19
by: viki1967 | last post by:
Hi all. I should work this control with javascript: First select: 1) Frank 2) Anthony 3) Max 4) Mark 5) Vincent
3
by: micky125 | last post by:
Hey guys I have been checking the forum for a way to populate a second select field depending on the choice made from the first one. Basically i am working on projects and the delays that occur. The...
2
by: phpnewbie26 | last post by:
I currently have two drop down menus where the second one is populated from the first one. My second drop down menu should be able to do multiple selection. I have searched online and found out how...
5
by: gidmakus | last post by:
I want three select fields where by each field is dependant on the other, what i mean is the first select field shows the values in the second while the second show the values in the the third field....
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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:
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: 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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

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.