Location: PHPKode > projects > Decider > decider/Organization/organization.php
<?php

require("../common/database.php");

?><head><link rel="stylesheet" type="text/css" href="../common/styles.css" />
</head>
<script language="javascript">

<!--
//Ajax coding--------------------------------------------------
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?");
	}
}

//Our XmlHttpRequest object to get the auto suggest
var select_domainkp_req = getXmlHttpRequestObject();

function select_domain_kp() {
	txt=document.getElementById("domain").value;
	//alert(txt);
if (select_domainkp_req.readyState == 4 ||select_domainkp_req.readyState == 0) {
		var str = escape(txt);
						//alert(str);
		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="+no_of_kp);
		 str = select_domainkp_req.responseText.split("\n");
		 //alert(str);
		 for(i=0;i<no_of_kp;i++){
			document.getElementById("txtkptype"+i+"").innerHTML=str;
			
			
			}
	}
}

//End of Ajax coding-----------------------------------------------------------

function kpload(obj){
	
		//alert("hello"); //obj.selectedIndex
		//var no_of_kp=document.Fdanu.no_of_kp.options[document.Fdanu.no_of_kp.selectedIndex].value;
		code = '<br><br><br>';
		var j=0;
		for(i=0;i<obj.selectedIndex+1;i++){
			txtDesi = "txtDesignation"+i;
			txtName="txtName"+i;
			txtAdd="txtAdd"+i;
			txtMobile="txtMobile"+i;
			txtHome="txtHomeTel"+i;
			txtWork="txtWorkTel"+i;
			txtEmail="txtEmail"+i;
			txtkptype="txtkptype"+i;
			//divid="divele"+i;
			j++;
			 code = code+'<b class="label">'+(j)+'.</b><table class="table" ><tr><td width="auto" class="label">Name</td><td><input class="textbox1" type="text" id="'+txtName+'" name="'+txtName+'"/></td></tr><tr><td width="auto" class="label">Designation </td><td><input class="textbox1" type="text" id="'+txtDesi+'" name="'+txtDesi+'"/></td><td class="label">Key Person Type </td><td><select class="select" style="width:120px;" id="'+txtkptype+'" name="'+txtkptype+'"></select></td></tr><tr><td rowspan="4" valign="top" class="label">Address</td><td rowspan="4"><textarea class="textboxarea1"name="'+txtAdd+'" id="'+txtAdd+'" cols="25" rows="3"></textarea></td></tr><tr><td class="label">Home Tel</td><td><input class="textbox1" type="text" id="'+txtHome+'" name="'+txtHome+'"/></td></tr><tr><td class="label">Work Tel </td><td><input class="textbox1" type="text" id="'+txtWork+'" name="'+txtWork+'"/></td></tr><tr><td class="label">Mobile </td><td><input class="textbox1" type="text" id="'+txtMobile+'" name="'+txtMobile+'"/></td></tr><tr><td class="label">E-mail</td><td><input class="textbox1" type="text" id="'+txtEmail+'" name="'+txtEmail+'"/></td></tr></table><br>';
				
				/*<td><input class="txtbox" type="text" id="'+txtName+'" name="'+txtName+'"/></td>
				</tr>';*/
			
		//document.write(<input type="text" id>);
		}
		//code=code+'<input  class ="button" type="button" id="add" value="Add" / >';
		document.getElementById("writehere").innerHTML = code;
		document.getElementById("number").value=obj.selectedIndex+1;
		//alert(document.getElementById("number").value);	
}
//-->
</script>
<!-- help code-->
<script language="javascript">
var id;
var txtname;
function handleSearchSuggest(txt) {
var str;

			id=txt;
			txtname=txt;		
			var ss = document.getElementById("help");
			ss.innerHTML = '';
			if(id=="organisationhelp"){
		    str = "From those initial answers given by client, analyst can identify key persons (people that you are going to interview) in that organization. Then you can enter the details about those key persons and also you can assign predefine key person type. Just select organization name, domain name and number of key person that you are going to enter ";
			}
			
			var suggest = '<div onmouseover="javascript:helpOver(this);" ';
			suggest += 'onmouseout="javascript:helpOut(this);" ';
			suggest += 'onclick="javascript:closeBox(this.innerHTML);" ';
			suggest += 'class="suggest_link">'+ str + '</div>';
			ss.innerHTML += suggest;
			}

//Mouse over function
function helpOver(div_value) {
	div_value.className = 'help_over';
}
//Mouse out function
function helpOut(div_value) {
	div_value.className = 'help_out';
}
//Click function
function closeBox(value) {
	document.getElementById("help").innerHTML = '';
}

</script>

<div class="topic">Organization Structure Details</div>
<form name="organization" id="organization" method="post">

<table >

	<tr><td class="label">Organization Name</td><td><select  id="organization_name" name="organization_name" class="select">
			<?php $result = mysql_query( "SELECT * FROM client");
			 while($row=mysql_fetch_array($result)){
			 ?>
				<option value="<?php echo $row['Name']?>"><?php echo $row['Name']?></option>
				
			<?php
			 }
			 
			?>
	</select></td><td><img src="../common/HelpIcon.gif" height="30" width="30" type="" name="Submit"  id="organisationhelp" onClick="handleSearchSuggest(this.id)" class="pointer"><div id="help" class="length" >
</td></tr><!--below select style tab must hava a onchange event to get the data about key person type  which  are available for selected domain-->
	
	<tr><td class="label">Domain Name</td><td><select  id="domain" name="domain" onchange="" class="select">
			<?php $result = mysql_query( "SELECT * FROM domain");
			 while($row=mysql_fetch_array($result)){
			 ?>
				<option value="<?php echo $row['Name']?>"><?php echo $row['Name']?></option>
				
			<?php
			 }
			 
			?>
	</select></td></tr>

<br />
<tr><td class="label">No of keyPerson</td><td> <select name="no_of_kp" onChange="javascript:kpload(this),select_domain_kp();" id="no_of_kp" class="select"> <!-- javascript: -->
        <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>
	<input type="hidden" id="number" name="number" value="" / >
	</td></tr>
	 </table>
<div class="topic">Key Person's Personal Details</div>
	<span id="writehere" ></span>
	<table class="label" align="center">
	<tr>
<input type="submit" value="      Add      " class="button" name="add">

</tr>
   </table>

</form>

Return current item: Decider