<?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 = 'skip' ORDER BY productName ASC";
	$result = execsql($q);
	$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++;
	}
?>
<h3>Add New Recipie</h3>
<form action="manipulation/inputRecipie.php" method="POST">
<table>
<tr><td></td><td>Quantity / Skip</td><td>Cost Per Unit</td></tr>
<tr><td>Recipie Name:</td> <td><input name="recipieName" type="text" /></td></tr>
<?php 

	for ($b = 0 ; $b < count($arrName); $b++) {

        echo "<tr><td>$arrName[$b]($arrUnit[$b]/Skip):</td> <td><input name=\"$arrName[$b]\" type=\"text\" /></td><td><input name=\"$arrName[$b]Price\" type=\"text\" /></td></tr>";
    }

?></table>
		<input type="hidden" name="cat" value="<?php echo $cat?>" /><br />
<input type="submit" name="submitok" onclick="return validate();"
	value="Save and New" /><input type="submit" name="submitok" onclick="return validate();"
	value="Save and Close" /><input type="reset" value="Reset Form" /></form>

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