<?php
include("sessionLogin.php");
include("connect.php");
$id=$_GET['id'];
$client=$_SESSION['client'];
$clientid=mysql_query("select * from  customer where userID='$client'");
$clientresult=mysql_fetch_array($clientid);
$clientid2=$clientresult['no'];
?>
<html>
<head>
<script src="rating/jquery.js" type="text/javascript"></script>
<script src="rating/jquery.rating.js" type="text/javascript" language="javascript"></script>
<link href="rating/jquery.rating.css" type="text/css" rel="stylesheet"/>

<style type="text/css">
.stat_post {
display: inline-block;
height: 20px;
line-height: 18px;
vertical-align: middle;
overflow: hidden;
}
.header-text {
color: #000000;
font-weight: normal;
font-size: 12px;
font-family: "Lucida Grande",Tahoma,Verdana,Lucida,Arial,sans-serif;
}
.headtext{
height: 1.5em;
width: 23em;
-moz-border-radius: 1em 4em 1em 4em;
border-radius: 1em 4em 1em 4em;
background: rgb(226,226,226); /* Old browsers */
background: -moz-linear-gradient(top, rgba(226,226,226,1) 0%, rgba(219,219,219,1) 50%, rgba(209,209,209,1) 53%, rgba(254,254,254,1) 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(226,226,226,1)), color-stop(50%,rgba(219,219,219,1)), color-stop(53%,rgba(209,209,209,1)), color-stop(100%,rgba(254,254,254,1))); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, rgba(226,226,226,1) 0%,rgba(219,219,219,1) 50%,rgba(209,209,209,1) 53%,rgba(254,254,254,1) 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, rgba(226,226,226,1) 0%,rgba(219,219,219,1) 50%,rgba(209,209,209,1) 53%,rgba(254,254,254,1) 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, rgba(226,226,226,1) 0%,rgba(219,219,219,1) 50%,rgba(209,209,209,1) 53%,rgba(254,254,254,1) 100%); /* IE10+ */
background: linear-gradient(top, rgba(226,226,226,1) 0%,rgba(219,219,219,1) 50%,rgba(209,209,209,1) 53%,rgba(254,254,254,1) 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#e2e2e2', endColorstr='#fefefe',GradientType=0 ); /* IE6-9 */
}
p .result{
color: #000000;
font-weight: normal;
font-size: 16px;
font-family: "Lucida Grande",Tahoma,Verdana,Lucida,Arial,sans-serif;
}
div .showresult{
width:300px;
height:130px;
}
</style>
<script type="text/javascript">
function sendsubmit(){
//var a = document.getElementById("rate").value;
var str = $("form").serialize();
var b = document.getElementById("pid").value;
var c = document.getElementById("client").value;
var d = document.getElementById("contents").value;

	if((str=="")||(d=="")){
		alert("please check your rating and comment");
	}
	else{
		if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
			xmlhttp=new XMLHttpRequest();
		}else{// code for IE6, IE5
			xmlhttp=new ActiveXObject('Microsoft.XMLHTTP');
		}
		xmlhttp.onreadystatechange=function(){
			if(xmlhttp.readyState==4 && xmlhttp.status==200){
				document.getElementById('showresult').innerHTML=xmlhttp.responseText;
			}
		} 
		xmlhttp.open('GET','sendrating.php?a='+str+'&b='+b+'&c='+c+'&d='+d+'',true);
		xmlhttp.send();  
		//alert(str+" "+b+" "+c+" "+d);
	}

}
</script>

</head>
<body>
<div class="showresult" id="showresult">
<div class="headtext">
<div class="header-text">
<pre>  What you think of this product?</pre>
</div>
</div>


<div class="stat_post" align=left>
<form>
  <input type="radio" class="star" name="api" value="Rubbish"/>
  <input type="radio" class="star" name="api" value="Normal"/>
  <input type="radio" class="star" name="api" value="Good"/>
  <input type="radio" class="star" name="api" value="VeryGood"/>
  <input type="radio" class="star" name="api" value="Best"/>
</form> 
</div> 
	<input type="hidden" name="pid" id="pid" value="<?php echo $id?>">
	<input type="hidden" name="client" id ="client" value="<?php echo $clientid2?>">
  </br>
  <textarea name="contents" id="contents" cols="50" rows="10" class="input_1" maxlength="500" style="margin-right: 0px; margin-left: 0px; width: 364px; vertical-align: top; margin-top: 5px; margin-bottom: 5px; height: 50px; resize:none;"></textarea></br>
<input type="button" value=" Submit " onClick="sendsubmit()"/>
</div> 
  

 </body>
 </html>
<?php
include("closeconnection.php");
?>