<?php
	include("../include/session.php");
//	include("../include/db.php");
	if(!$session -> isAdmin()){
		header("Location: ../main.php");
	}else{
		include("../productionHeader.php");
	$q = "SELECT productName, unit FROM products WHERE category = 'Direct Materials' AND subCategory = 'Wet' ORDER BY productName ASC";
	$result = execsql($q);
	$pricing = mysql_fetch_array($result, MYSQL_NUM);
//	print_r($pricing);
	$num = mysql_num_rows($result);
	$arrName = array();
	$i = 0;
	while($i < $num){
		$arrName[$i] = mysql_result($result, $i, "productName");
		$arrUnit[$i] = mysql_result($result, $i, "unit");
		$i++;
	}
	
	$q1 = "SELECT * FROM perwetprice ORDER BY id DESC LIMIT 1";
	$r1 = execsql($q1);
	$price = mysql_fetch_array($r1, MYSQL_ASSOC);
	
	$q2 = "SELECT * FROM recipiewet ORDER BY id DESC LIMIT 1";
	$r2 = execsql($q2);
	$amount = mysql_fetch_array($r2, MYSQL_ASSOC);
	
?>
<h3>Add New Recipie (Wet)</h3>

<form action="manipulation/inputWet.php" method="POST">
<table>
<tr><td></td><td>Amount per Hour</td><td>Cost Per Hour</td></tr>
<?php 
	

	for ($b = 0 ; $b < count($arrName) ; $b++) {
		$product = $arrName[$b];
        echo "<tr><td>$arrName[$b]($arrUnit[$b]/Tile):</td> <td><input name=\"$arrName[$b]\" value=\"$amount[$product]\" type=\"text\" /> </td><td><input name=\"$arrName[$b]Price\" value=\"$price[$product]\" type=\"text\" /></td></tr>";
    }

?></table>
<input type="reset" value="Reset Form" />
    	<input type="submit" name="submitok" value="   OK   " />
</form>

    	
 <?php 
 		include("../footer.html");
	}
 ?>