<head>
<?php
$table_name = $_SESSION['db_prefix']."_store_items";
if ($_SESSION['subCategory']=="Timber") {
$dropDownQuery = "SELECT store_item_id, item_name, unit FROM $table_name WHERE category= '".$_SESSION['category']."' AND subCategory = '".$_SESSION['subCategory']."' ORDER BY width, depth,length ASC";
}
else {
$dropDownQuery = "SELECT store_item_id, item_name, unit FROM $table_name WHERE category= '".$_SESSION['category']."' AND subCategory = '".$_SESSION['subCategory']."' ORDER BY item_name ASC";
}

if ($_SESSION['category']=="Old") {
	$dropDownQuery = "SELECT store_item_id, item_name, unit FROM $table_name WHERE category= 'Old' ORDER BY item_name ASC";
}

$dropDownResult = execsql($dropDownQuery);
	$num = mysql_num_rows($dropDownResult);
	$a = 0;
	$arrId = array ();
	$arrName = array ();
	while ($a < $num) {
		$arrId[$a] = mysql_result($dropDownResult, $a, "store_item_id");
		$arrName[$a] = mysql_result($dropDownResult, $a, "item_name");
		$arrUnit[$a] = mysql_result($dropDownResult, $a, "unit");
		
		$a++;
	}

?>

</head>

<?php include('../include/wait.php') ?>

<body onLoad="MM_showHideLayers('wait','','hide')" onFocus="MM_showHideLayers('wait','','hide');"  onBlur="MM_showHideLayers('wait','','hide');">
<form id="form1" name="form1" method="get" action="editWizbase.php">
  <table width=595 border="0" align="left" cellpadding="10" cellspacing="0" bordercolor="#0066FF" border-collapse="collapse">
    <tr>
      <td width="525" ><div class="wizard_frame">
          <label class="label_std"> Select item to edit:&nbsp;&nbsp;&nbsp; </label>
          <select name="store_item_select" id="store_item_select" class="select160" autofocus tabindex="1">
            <option value="<?php echo $_SESSION['store_item_id']?>" ><selected="selected"><?php echo $_SESSION['store_item_name']?></option>
            <?php
    	for ($i = 0; $i < count($arrId); $i++) {
		echo "<option value=" . "\"" . $arrId[$i] . "\"" . ">" . $arrName[$i] . "</option>";
		$_SESSION['productName'] = $arrName[$i];
		//foreach($arrId as $key=>$value){
			//echo "<option value=\"delivery.php?store_item_id=".$arrId[$i]."&cat=$cat&formEnabled2=1&date=$date" . "\"" . ">" . $arrName[$i] . "</option>";	
	    }
     ?>
          </select>
          &nbsp;
          <label class="star">*</label>
          <br />
          <br />
        </div></td>
    </tr>
    <tr>
      <td><table width="590" height="50" align="center" id="table_button_bar">
          <tr>
            <td width="117"><input type="button" name="prev_button" id="prev_button" class="imagebutton" value="Prev" onClick=" needToConfirm = false; ;MM_goToURL('parent','editWizbase.php?p=1&amp;s=0');return document.MM_returnValue; MM_showHideLayers('wait','','show');" tabindex="3"/></td>
            <td><span class="wizard">
              <input name="error" type="hidden" id="error" value="0" />
              <input name="p" type="hidden" id="p" value="2" />
              <input name="s" type="hidden" id="s" value="2" />
              </span></td>
            <td width="125" align="left"><input name="cancelbutton" type="button" class="imagebutton" id="cancelbutton" onClick="needToConfirm = false; cancel_confirmation(1, '../store/store_main.php'); " value="Cancel" tabindex="4" /></td>
            <td width="110" align="left"><input type="submit" name="next_button" class="imagebutton" value="Next" onClick="needToConfirm = false; MM_showHideLayers('wait','','show');" tabindex="2"/></td>
          </tr>
        </table></td>
    </tr>
  </table>
</form>
<!--form validation--> 
<script language="JavaScript" type="text/javascript" xml:space="preserve">
  var frmvalidator  = new Validator("form1");
  frmvalidator.EnableMsgsTogether();
  frmvalidator.addValidation("store_item_select","req","Please select a product.");
  
  </script> 
