Location: PHPKode > projects > Decider > decider/Questionaire/questionairetab.php
<?php

	require('../Login/authen.php');

?>
<html>
<head>
<title>Decider - Information Gathering Assistant</title>
<link rel="stylesheet" type="text/css" href="../ajaxtabs/ajaxtabs.css" />
<link rel="stylesheet" type="text/css" href="../common/styles1.css" />

<script type="text/javascript" src="../ajaxtabs/ajaxtabs.js">
</script>

</head>

<body>
<div id='maindiv' align="center">
<table width="800px"><tr><td align="left" valign="top"><?php require('../common/top.html'); ?></td>
	</tr></table>

<table background="../common/tableback.png" width="800px" height="800px">
<tr align="right"><td></td><td class="label" align="right">
	<?php 
	
echo $_SESSION['username'];
?></td></tr>
	<tr>
	
		<td align="left" valign="top"><?php require('../common/menu.html'); ?></td>
		<td width="600px" align="left" valign="top"><?php require('../Questionaire/questionaire.php'); ?></td>
	</tr>

</table>



<?php

//to add data to client table
if(isset($_POST['add'])){
	
	//selecting right domain name
	
	$domain_query = "select Domain_Name from key_person where Id='".$_POST[kp_id]."'";
	$result = mysql_query($domain_query, $link);
	$raw=mysql_fetch_array($result);		
	
	$domain=$raw['Domain_Name'];

	//checking answered questions
	for($i=0;$i<1000;$i++){
	
		if(isset($_POST[$i])){
		
			$textarea="textarea".$i;
		
			$q_string="INSERT INTO client_feedback (Domain_Name, Keyperson_Id, Quiz_Id, Answer, turn) VALUES ('$domain','$_POST[kp_id]','$i','$_POST[$textarea]','$_POST[turn]')";
		
			if (!mysql_query($q_string,$link)){
	  			die('Error: ' . mysql_error());
	  		}

		}
		
	}
		
	echo "records added";
	mysql_close($link);
	
}

?>

<?php 
//to edit data in client table
if(isset($_POST['edit'])){
	
	if (!$link)	{
  		die('Could not connect: ' . mysql_error());
  	}

	$q_string="UPDATE analyst SET Name = '$_POST[analyst_name]',Address='$_POST[analyst_address]',Work_Tel='$_POST[analyst_work_telno]',Home_Tel='$_POST[analyst_home_telno]',Mobile='$_POST[analyst_mobileno]',Email='$_POST[analyst_email]',User_Name='$_POST[analyst_username]',Password='$_POST[analyst_password]' WHERE Id = '$_POST[analyst_id]'";
	
	if (!mysql_query($q_string,$link)){
	  die('Error: ' . mysql_error());
  	}

	echo "1 record edited";
	
	mysql_close($link);
}
?>

</div>

</body>

</html>



Return current item: Decider