Location: PHPKode > projects > Decider > decider/Key_Person/addkeyperson.php
<html>
<head><link rel="stylesheet" type="text/css" href="../common/styles.css" />

<script language="javascript">

<!--

//Ajax stuff here
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?");
	}
}

var select_domainkp_req = getXmlHttpRequestObject();


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

function handleselect_domainkp() {

	if (select_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=select_domainkp_req.responseText;
		//alert(str);
		 document.getElementById("available_kp").innerHTML=str;		 
	}
}

//end of Ajax stuff

function kpload(obj){

	//alert("hello"+obj.value);
	var code="<br>";
	j=0
	for(i=0;i<obj.value;i++){
		txtid="domainkp"+i;
		j++;
		code=code+"<tr ><td class='label'>"+j+". Name </td><td><input type='text' class='textbox' id='"+txtid+"' /></td></tr><br />";
	}
	code=code+'<tr><td></td><td><input type="submit" value="Add" class="button" name="add"></td><td><input type="button" value=" Cancel " class="button"></td></tr>';	
	//alert(code);
		document.getElementById("domainkptable").innerHTML=code;
		document.getElementById("number_of_key_person").value=obj.value+1
}
//-->
</script>
</head>
<body>
<form action="keypersontab.php" method="post">


<table border="0">


<tr>
	<td class="label">Domain Name</td>
	<td>
	<select id="domain_name"  name="domain_name" class="select"onChange="javascript:select_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="addkeypersonhelp" onClick="handleSearchSuggest(this.id)" class="pointer"><div id="help" class="length" >
 </div>
</td>
</tr>

<tr><td class="label">Available Key Persons </td><td id="available_kp"> </td></tr>
<tr></tr>
</table>
<br />
<div class="topic">Add Key Person</div>
<br />
<table>


<tr><td class="label">No of Key Person </td><td>
<select name="no_of_kp" onChange="javascript:kpload(this);" id="no_of_kp" class="select" > <!-- javascript: -->
		<option>-select-</option>
        <option value="1" >1</option>
        <option value="2" >2</option>
        <option value="3" >3</option>
        <option value="4" >4</option>
        <option value="5" >5</option>
        <option value=6 >6</option>
        <option value=7 >7</option>
        <option value=8 >8</option>
        <option value=9 >9</option>
        <option value=10 >10</option>
        <option value=11 >11</option>
        <option value=12 >12</option>
        <option value=13 >13</option>
        <option value=14 >14</option>
        <option value=15 >15</option>
        <option value=16 >16</option>
        <option value=17 >17</option>
        <option value=18 >18</option>
        <option value=19 >19</option>
        <option value=20 >20</option>
        <option value=21 >21</option>
        <option value=22 >22</option>
        <option value=23 >23</option>
        <option value=24 >24</option>
        <option value=25 >25</option>
       
    </select></td>
	</tr>  
<tr><td></td><td>
	<input type="hidden" id="number_of_key_person" name="number_of_key_person" value="" / >
	</td></tr>
</table>
<table id="domainkptable">

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

<table>

</table>

</form>

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