<?
require("config.inc");
$productID = $_GET['ProID'];
$AdminID = $_SESSION['AdminID'];
$theValue = $_GET['type'];
$getSelect = $_GET['type2'];
//echo "<script>alert('".$theValue."');</script>";
?>
<Script>
function selectValue(val){
	//document.getElementByName('Ptype').value = val.value;
		window.location=val;
}

</Script>

<center>
		<a href="http://www.tnchemie.com.my"><img src="pic/projectTitle.JPG" border="0px"></a>
		</center>
<table width="100%" height="5px" bgcolor="#66FF66">
<tr><td align="left">Welcome, <a href="editAdmin.php?adminID=<?echo "$AdminID"; ?>"><?echo "$AdminID"; ?></a>, <a href="logout.php">Logout</a></td></tr>
</table><br/>
<?

//echo "<script>alert('".$productID."');</script>";

echo "<form method='POST' action='addProductAction.php'>";
echo "<center>";
echo "<table border='1' bordercolor='green'>";

if($getSelect=='NORMAL'){
	echo "<tr><td>Product Type</td><td>";
	?>
	<select name="selectType" id="selectType" onchange="selectValue('addProduct.php?type2='+this.value)">
	<?
	echo "<option value='NO'>-</option>";
	echo "<option value='NORMAL' selected>NORMAL</option>";
	echo "<option value='WARNING'>WARNING</option></select>";
	echo "<input type='hidden' name='Ptype' value='$getSelect'>";
	echo "</td></tr>";
}
else if($getSelect=='WARNING'){
	echo "<tr><td>Product Type</td><td>";
	?>
	<select name="selectType" id="selectType" onchange="selectValue('addProduct.php?type2='+this.value)">
	<?
	echo "<option value='NO'>-</option>";
	echo "<option value='NORMAL'>NORMAL</option>";
	echo "<option value='WARNING' selected>WARNING</option></select>";
	echo "<input type='hidden' name='Ptype' value='$getSelect'>";
	echo "</td></tr>";
}
else{
	echo "<tr><td>Product Type</td><td>";
	?>
	<select name="selectType" id="selectType" onchange="selectValue('addProduct.php?type2='+this.value)">
	<?
	echo "<option value='NO'>-</option>";
	echo "<option value='NORMAL'>NORMAL</option>";
	echo "<option value='WARNING'>WARNING</option></select>";
	echo "<input type='hidden' name='Ptype' value='$getSelect'>";
	echo "</td></tr>";
}
echo "<tr><td>Product ID</td><td><input type='text' name='PID' value=''></td></tr>";
echo "<tr><td>Product Name</td><td><input type='text' name='Pname' value=''></td></tr>";
echo "<tr><td>Product description</td><td><input type='text' name='Pdesc' value=''></td></tr>";
echo "<tr><td>Product Price(RM)</td><td><input type='text' name='Pprice' value=''></td></tr>";
echo "<tr ><td colspan='2' align='center'><input type='submit' value='submit'><a href='checkProduct.php' align='right'>Back</a></td></tr>";
echo "</table>";
echo "<h5 style='color:red'>Insert all blank</h5>";
echo "</center>";
echo "</form>";
?>