Location: PHPKode > projects > Decider > decider/Key_Person/editkeyperson.php
<html>
<head><link rel="stylesheet" type="text/css" href="../common/styles.css" />
<script language="javascript" >
//Active when click the edit button on the each key person
var edit_domainkp_req = getXmlHttpRequestObject();
function edit_kp(txt){
	//alert(txt);
	chvalue=document.getElementById(txt).value;
	//alert(chvalue);
	if (edit_domainkp_req.readyState == 4 ||edit_domainkp_req.readyState == 0) {
		var str = escape(txt);
						
		edit_domainkp_req.open("GET",'editkp.php?k_id='+ str+'&newkp='+ chvalue, true);
		edit_domainkp_req.onreadystatechange = editselect_domainkp; 
		edit_domainkp_req.send(null);
		
	}		
}

function editselect_domainkp(){
	if (edit_domainkp_req.readyState == 4) {
	
		
		str=edit_domainkp_req.responseText;
		alert(str);
		// document.getElementById("available_kp").innerHTML=str;		 
	}
str=edit_domainkp_req.responseText();
}


//Ajax object method
function getXmlHttpRequestObject() {
	if (window.XMLHttpRequest) {
		return new XMLHttpRequest();
	} else if(window.ActiveXObject) {
		return new ActiveXObject("Microsoft.XMLHTTP");
	} else {
		alert("Your Browser Sucks!\nIt's about time to upgrade don't you think?");
	}
}
//active when domain changed
var show_domainkp_req = getXmlHttpRequestObject();


function show_domain_kp(txt) {
	//alert(txt);
if (show_domainkp_req.readyState == 4 ||show_domainkp_req.readyState == 0) {
		var str = escape(txt);
						
		show_domainkp_req .open("GET",'selectedit.php?domain=' + str, true);
		show_domainkp_req .onreadystatechange =selecttoedit_domainkp; 
		show_domainkp_req.send(null);
		
	}		
}

function selecttoedit_domainkp() {

	if (show_domainkp_req.readyState == 4) {
	
		//no_of_kp=document.getElementById("no_of_kp").value;
		//alert("no of kp=");
		// str = select_domainkp_req.responseText.split("\n");
		str=show_domainkp_req.responseText;
		//alert(str);
		 document.getElementById("available_kp").innerHTML=str;		 
	}
}


//end of Ajax stuff
</script>
</head>
<body>
<form method="post" action="" name ="edit_domain_kp" id="edit_domain_kp">
<table border="0">

<tr>
	<td class="label">Domain Name :</td>
	
	<td>
	<select id="txtHint" id="domain_name" name="domain_name" class="select" onChange="javascript:show_domain_kp(this.value);" >
	<option>-select-</option>
		<?php
		require("../common/database.php");
		 $result = mysql_query( "SELECT Name FROM domain");
			 while($row=mysql_fetch_array($result)){
			 	?>
				<option value="<?php echo $row['Name']?>"><?php echo $row['Name']?></option>
				
				<?
			 }
			 
			?>
	</select>
	</td>
	<td><img src="../common/HelpIcon.gif" height="30" width="30" type="" name="Submit"  id="editkeypersonhelp" onClick="handleSearchSuggest(this.id)" class="pointer"><div id="help" class="length" >
 </div>
</td>
</tr>

<tr><td class="label">Available KeyPerson:</td><td id='available_kp'></td></tr>


<tr><td></td>
<td><input type="submit" value="Ok" class="button" name="edit">
<input type="reset" value=" cancel " class="button"></td>
</tr>
</table>

</form>

</body>
</html>
Return current item: Decider