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

I had a customer drop down if i select customer i should fetch the addaress and tinno

Please check this code and reply me .....

Expand|Select|Wrap|Line Numbers
  1. <script language="JavaScript">
  2.  
  3.     var listObj=document.getElementById('customer');
  4.  
  5.     listObj.selectedIndex=0;
  6. //    var ind=document.getElementById('list').selectedIndex;
  7. //alert(ind);
  8.  
  9.     if(listObj.value!=""){
  10.         showUser(listObj.value)     
  11.     }
  12.         document.getElementById('customer').style.width="158";
  13.  
  14. //    document.getElementById('client_list').selectedIndex=0;
  15.     </script>
  16.  
  17.  
  18.  
  19. var xmlHttp;
  20.  
  21. var isIE = false;
  22.  
  23. // on !IE we only have to initialize it once
  24. if (window.XMLHttpRequest) {
  25.     xmlHttp = new XMLHttpRequest();
  26. }
  27.  
  28. function showUser(str)    
  29. {
  30.  
  31. if (window.XMLHttpRequest) {
  32.        // branch for IE/Windows ActiveX version
  33.  
  34.    } else if (window.ActiveXObject) {
  35.        xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
  36.    }
  37.  
  38.    if (xmlHttp==null)
  39.    {
  40.     alert ("Browser does not support HTTP Request");
  41.     return;
  42.   }
  43.  
  44.  
  45.  var url="php/invoicedisply.php"
  46.  
  47.  url=url+"?q="+str
  48.  url=url+"&frm=Client"
  49.  url=url+"&sid="+Math.random()
  50.  
  51.  xmlHttp.onreadystatechange=processChanged
  52.  xmlHttp.open("GET",url,true)
  53.  xmlHttp.send(null)
  54.  }
  55.  
  56.  function processChanged()
  57. {
  58.  
  59. if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
  60. {
  61.  
  62.  
  63.  xmlDoc=xmlHttp.responseXML;
  64.  
  65. document.getElementById("address1").value=xmlDoc.getElementsByTagName("address1")[0].childNodes[0].nodeValue;
  66. document.getElementById("tinno").value=xmlDoc.getElementsByTagName("tinno")[0].childNodes[0].nodeValue;
  67. }
  68. }
  69.  
  70.  
  71.  
  72.  
  73. <?php
  74.     header('Content-Type: text/xml');
  75.     header("Cache-Control: no-cache, must-revalidate");
  76.  
  77.     require("db_connect.php");
  78.  
  79.     $frm=$_GET['frm'];
  80.     if($frm=="Client")
  81.     {
  82.         $q=$_GET["q"];
  83.  
  84.        $sql="SELECT address1,tin_no FROM customermaster WHERE customer_id='".$q."'";
  85.  
  86.         //echo $sql;
  87.         $result = mysql_query($sql,$link);
  88.         checkError($result);
  89.         echo '<?xml version="1.0" encoding="ISO-8859-1"?><customer>';
  90.  
  91.         while($row = mysql_fetch_array($result))
  92.     {
  93.  
  94.            echo "<address1>". $row['address1']."</address1>";
  95.  
  96.              echo "<tinno>". $row['tin_no']."</tinno>";
  97.  
  98.         }
  99.         echo "</customer>";
  100.     }
  101.  
  102.  
  103.  
  104.     mysql_close($link);
  105.     die();
  106.  
  107.     function checkError($result)
  108.     {
  109.         if(!$result){
  110.             echo "<font size=\"4\">MySQL Error : ".mysql_error()."</font>";
  111.             mysql_error();
  112.             die();
  113.         }
  114.     }
  115.  
  116. ?>
Jun 26 '12 #1
1 1241
Dormilich
8,658 Expert Mod 8TB
and what exactly is the problem?
Jun 26 '12 #2

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

Similar topics

4
by: Nanos | last post by:
For the form I need to create drop down select with say five different options. There also should be possibility to enter own option if one is not listed. How can I do it.? Thank you in advance...
3
by: Terry Murray | last post by:
Hi everybody: I am trying to write a generic function, isValidMonth, that can used on 2 form elements, smonth and emonth. I would like the function to test whether the user has selected a...
1
by: Nanos | last post by:
Hi all, For the form I need to create drop down select with say five different options. There also should be possibility to enter own option if one is not listed. Is there a way to do it. Did...
2
by: Nanos | last post by:
Hi all, For the form I need to create drop down select with different options (dynamicly from DB). That's easy in PHP. But there also should be the possibility to enter own option if one is not...
0
by: john | last post by:
Hello, I heared that there is a sample custom drop down control that I can use in my asp.net web app. The drop down allows the user the type not only the first letter but then the second,...
1
by: Joe Attardi | last post by:
Hi all, On a form on one of my pages I have two <select> elements, and each one is paired up with a radio button. The idea is to choose an item from one list or the other and select the radio...
0
by: David | last post by:
I cannot get a simple changing of a SelectCommand for a SqlDataSource used in a drop-down list to work. If I do the same process to my GridView SqlDataSource it works fine. Can anyone help? I am...
3
by: printline | last post by:
Hello All I need some help in a form i'm creating. I have to fields with drop down select boxes. What i want to do is, when a user selects a given value in one drop down, the other drop down...
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.