Expand|Select|Wrap|Line Numbers
- <script language="JavaScript">
- var listObj=document.getElementById('customer');
- listObj.selectedIndex=0;
- // var ind=document.getElementById('list').selectedIndex;
- //alert(ind);
- if(listObj.value!=""){
- showUser(listObj.value)
- }
- document.getElementById('customer').style.width="158";
- // document.getElementById('client_list').selectedIndex=0;
- </script>
- var xmlHttp;
- var isIE = false;
- // on !IE we only have to initialize it once
- if (window.XMLHttpRequest) {
- xmlHttp = new XMLHttpRequest();
- }
- function showUser(str)
- {
- if (window.XMLHttpRequest) {
- // branch for IE/Windows ActiveX version
- } else if (window.ActiveXObject) {
- xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
- }
- if (xmlHttp==null)
- {
- alert ("Browser does not support HTTP Request");
- return;
- }
- var url="php/invoicedisply.php"
- url=url+"?q="+str
- url=url+"&frm=Client"
- url=url+"&sid="+Math.random()
- xmlHttp.onreadystatechange=processChanged
- xmlHttp.open("GET",url,true)
- xmlHttp.send(null)
- }
- function processChanged()
- {
- if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
- {
- xmlDoc=xmlHttp.responseXML;
- document.getElementById("address1").value=xmlDoc.getElementsByTagName("address1")[0].childNodes[0].nodeValue;
- document.getElementById("tinno").value=xmlDoc.getElementsByTagName("tinno")[0].childNodes[0].nodeValue;
- }
- }
- <?php
- header('Content-Type: text/xml');
- header("Cache-Control: no-cache, must-revalidate");
- require("db_connect.php");
- $frm=$_GET['frm'];
- if($frm=="Client")
- {
- $q=$_GET["q"];
- $sql="SELECT address1,tin_no FROM customermaster WHERE customer_id='".$q."'";
- //echo $sql;
- $result = mysql_query($sql,$link);
- checkError($result);
- echo '<?xml version="1.0" encoding="ISO-8859-1"?><customer>';
- while($row = mysql_fetch_array($result))
- {
- echo "<address1>". $row['address1']."</address1>";
- echo "<tinno>". $row['tin_no']."</tinno>";
- }
- echo "</customer>";
- }
- mysql_close($link);
- die();
- function checkError($result)
- {
- if(!$result){
- echo "<font size=\"4\">MySQL Error : ".mysql_error()."</font>";
- mysql_error();
- die();
- }
- }
- ?>