
<body background="i.jpg">
<?php include("../../include/dbconnect.php");


// Get all _POST VALUES HERE..

  foreach($_POST as $p=>$t)
  {
     $_POST[$p] = trim($t);
  }

  $myProduct = $_POST['Product'];
?>

<title>Purchase Items View / Edit</title>
<body background=blater01.gif  topmargin=0>
<center>
<table cellpadding=0 cellspacing=4 width=590>
<tr>
<td style="padding:3px;" colspan=2 bgcolor="#93BEE2"><font face="Verdana, Arial, Helvetica, sans-serif"><b><b>Purchase Items View / Edit</b></font></td>
</tr><tr valign="top"><td colspan=2>
<font >&nbsp;</font>
</td>
</tr>
</table>
<table border=0 cellpadding=3 cellspacing=4 width="590">
       

      <tr > 
        <td width="139" height="31" align="right" ><font face="Verdana, Arial, Helvetica, sans-serif" size="1"><b><font color="#003366">Category
          &nbsp;</font></b></font></td><td>

<?

// Pull all the data from Product master & populate it

$stQuery = mysql_query("select distinct catcode,category from matprodcat order by category") or die(mysql_error());

?>
  <form name='myForm01' method='POST' action='<?=$_SERVER[PHP_SELF]?>'>
  <SELECT name='Product' onChange="javascript:submit();">

<?
     echo "<option selected value=\" 0\"> Select Category";
    while($row = mysql_fetch_row($stQuery))
    {


        if(isset($myProduct) && eregi("$myProduct",$row[0]))
	    {
            echo "<option selected value=\"$row[0]\">$row[1]";
        }
        else{
            echo "<option value=\"$row[0]\">$row[1]";
        }
    }
?>
        </SELECT>
</td></tr>
</form>


      <tr > 
        <td width="139" height="31" align="right" ><font face="Verdana, Arial, Helvetica, sans-serif" size="1"><b><font color="#003366">Product
          &nbsp;</font></b></font></td><td>
<?

// Pull all Customers from Customer  based on Selected Product id and populate it.


    $sProdQuery = mysql_query("SELECT distinct prodcode,prodname FROM rawmaterial WHERE (matcatcode ='$myProduct') ");


// This form contain a hidden field ProductID which can be later used in next  page..
?>

  <form name='myForm02' method='POST' action='view.php' >
  <input type="hidden" name="prodcode" value=<?echo($myProduct);?>>

      <?
      $sdt = date(d).'-'.date(m).'-'.date(Y); 


// Pull all the data from Standard master & populate it



?>
   <SELECT name='prodcode' >

<?
     echo "<option selected value=\" 0\"> Select Product";
    while($row = mysql_fetch_row($sProdQuery))
    {

            echo "<option value=\"$row[0]\">$row[1]";
        
    }
?>
        </SELECT>
</td></tr>

 



<table cellpading=0 cellspacing=10 width= 50>
<tr><td>
 <blockquote>  <input type =submit name="submit" value = "Submit"></td></blockquote>
</table>
</table>

<br><br><font size=1><center><a href="/wilson/stores.html">Return to Index page</center></font>
</body>
</form>
