<? ob_start();
session_start();
require_once("../dbconnect.php");
if($_GET['catid']!=""){
 $view="Select * from tblcategories where category_id=".$_GET['catid']; 
 $exeview=mysql_query($view);
 $viewrow=mysql_fetch_array($exeview);
 $category=$viewrow['categoryname']; 
 }
if($_GET['subcat']!=""){ 
 $view1="Select * from tblsubcategories where subcat_id=".$_GET['subcat']; 
 $exeview1=mysql_query($view1);
 $viewrow1=mysql_fetch_array($exeview1);
 $subsubcategory=$viewrow1['subcat_name'];
 }
  $prod=mysql_fetch_array(mysql_query("Select * from products where pid=".$_GET['prodid']));
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Welcome to Sir Box and Plastics</title>
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
-->
</style>
<link href="stylesheet.css" rel="stylesheet" type="text/css" />
<script language="javascript" src="valid.js"></script>
<script type="text/javascript" src="controls.js"></script>
<script type="text/javascript" src="controls1.js"></script>
<script type="text/javascript" src="sizes.js"></script>
  <!--<script language="JavaScript">
   
    function ramesh()
    {
      document.form.checkbox[0].checked == document.form.checkbox[0].defaultChecked;

      document.form.checkbox[1].checked == document.form.checkbox[1].defaultChecked;
    }
    
    </script>-->
    
<script type="text/javascript">
function ramesh();
{
	var d=document.form;
	
alert(document.getElementById("imprint").defaultChecked);
alert(document.getElementById("noprint").defaultChecked);
}


</script>
</head>
<body>
<table width="1003" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td valign="top"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
          <tr>
            <td><? require_once("header.php"); ?></td>
          </tr>
          <tr>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">



              <tr>
                <td><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
                    <tr>
                      <td height="30" class="cate_pro">
				Product in Category: "<? echo $category?>  <? echo $subcategory ?> - <? echo $subsubcategory ?>"</td>
                      <td>&nbsp;</td>
                      <td class="index_text" align="right">&nbsp;</td>
                      <td width="20">&nbsp;</td>
                    </tr>
                </table></td>
              </tr>
              <tr>
                <td>&nbsp;</td>
              </tr>
              <tr>
                <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td width="100%" valign="top" style="padding-right:1px;">
	
	
	
	<form  name="form" method="post" action="productinsert.php?action=edit" enctype="multipart/form-data" >
	
					<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#F2F1EE">
                        <tr>
                          <td height="40" colspan="6" align="center" bgcolor="#D7D6CC" class="cate_pro">Edit Product</td>
                          </tr>
						  <tr>
                          <td height="25" align="left">&nbsp;</td>
                          <td>&nbsp;</td>
                          <td align="left">&nbsp;</td>
                          <td colspan="3">&nbsp;</td>
                        </tr>
						  <tr>
                                    <td width="100" height="30" align="left">&nbsp;</td>
                                    <td width="60">&nbsp;</td>
                                    <td width="222"><label><strong>Item Number:</strong></label></td>
                                    <td  colspan="3"><input type="text" name="itemno" size="30" value="<?=$prod['itemno']?>" /></td>
                                  </tr>
						     <tr>
                          <td width="100" height="30" align="left">&nbsp;</td>
                          <td width="60">&nbsp;</td>
                          <td width="222"><label><strong>Product Name:</strong></label></td>
                          <td  colspan="3"><input type="text" name="pname" size="30" value="<?=$prod['pname']?>" /></td>
                        </tr>
						 
                                <!--<? 
							      if($prod[unitsprice]!="")
							      {
									  $resquans=explode(',',$prod[unitsprice]);
										  
								  for($i=0;$i<count($resquans);$i++)
								  {
									 $hiphonquan=explode('-', $resquans[$i]);
								  ?>  
						 <tr>
                                    <td width="10%" height="30" align="left">&nbsp;</td>
                                    <td width="6%">&nbsp;</td>
                                    <td width="16%"><label><strong>Unit:</strong></label></td>
                                    <td width="20%"><input name="unit[]" type="text" id="unit" size="17"  onkeyup="return validatephone(this)" value="<?=$hiphonquan[0]?>"/></td>
                                    <td width="5%" align="left"><label><strong>Price:</strong></label></td>
                                    <td width="38%"><input type="text" name="price[]" size="5" id="price" onkeyup="return validatephone(this)" value="<?=$hiphonquan[1]?>" />
                                      $</td>
                                  </tr>
                                  <? } } ?>-->
                                 
                                  <? 
							      if($prod[colors]!="")
							      {
									  $resquan=explode(',',$prod[colors]);
										  
								  for($i=0;$i<count($resquan);$i++)
								  {
									 
								  ?>  
                                   <tr>
                                    <td height="30" align="left">&nbsp;</td>
                                    <td>&nbsp;</td>
                                    <td><strong>Color&nbsp;<?=$i; ?>:</strong></td>
                                    <td  colspan="3"><input type="text" name="color[]" id="color" value="<?=$resquan[$i]?>"  /></td>
                                  </tr>
                                  <? } } ?>
                                  <tr>
                                    <td height="30" align="left">&nbsp;</td>
                                    <td>&nbsp;</td>
                                    
                                    <td  colspan="4" align="center"><p id="parah2" align="left"><span style="padding-left:160px;">Click below to add more.....</span></p>
                                      <a href="javascript:addInput1()" class="menu7"  style="margin-right:100px;"><img src="images/addmore.gif" border="0" /></a></td>
                                  </tr>
								    <tr>
                                    <td height="30" align="left">&nbsp;</td>
                                    <td>&nbsp;</td>
                                    <td><strong>Weight:</strong></td>
                                    <td  colspan="3"><input type="text" name="weight" id="weight" value="<?=$prod['weight']?>"  /></td>
                                  </tr>
								  	  <? 
							      if($prod[sizes]!="")
							      {
									  $resquan1=explode(',',$prod[sizes]);
										  
								  for($s=0;$s<count($resquan1);$s++)
								  {
									 
								  ?>  
								  <tr>
                                    <td height="30" align="left">&nbsp;</td>
                                    <td>&nbsp;</td>
                                    <td><strong>Sizes&nbsp;<?=$s; ?>:</strong></td>
                                    <td  colspan="3"><input type="text" name="size[]" id="size" value="<?=$resquan1[$s]?>" /></td>
                                  </tr>
							<? } } ?>
                                  <tr>
                                    <td height="30" align="left">&nbsp;</td>
                                    <td>&nbsp;</td>
                                   
                                    <td  colspan="4" align="center"><p id="parahsize" align="left"><span style="padding-left:160px;">Click below to add more.....</span></p>
                                      <a href="javascript:addInputsize()" class="menu7"  style="margin-right:100px;"><img src="images/addmore.gif" border="0" /></a></td>
                                  </tr>
                                  
								     <tr>
							   <td height="34">&nbsp;</td>
							   <td>&nbsp;</td>
							   <td><strong>Discount</strong></td>
							   <td width="351"><input type="text" name="discount" value="<?php echo $prod['discount'];?> " /></td>
							   </tr>
						<tr>
                          <td width="100" height="30" align="left">&nbsp;</td>
                          <td width="60">&nbsp;</td>
                          <td width="222"><label><strong>Description:</strong></label></td>
                          <td  colspan="3"><textarea name="description" rows="10" cols="25" /><?=$prod['description']?></textarea></td>
                        </tr>
                        
						
						  
						<tr>
                          <td width="100" height="30" align="left">&nbsp;</td>
                          <td width="60">&nbsp;</td>
                          <td width="222"><label><strong>Product Image1:</strong></label></td>
                          <td  colspan="3"><input type="file" name="prodimg1" size="30" />&nbsp;&nbsp;<img src="../images/products/<?=$_GET['prodid']?>-1.jpg?rand=<?=rand(1,1000); ?>" border="0" width="100" height="100" /></td>
                        </tr>
					
						
						
					
                        <tr>
                          <td height="25" align="left">&nbsp;</td>
                          <td>&nbsp;</td>
                          <td align="left"><strong>Product Image2:</strong></td>
                          <td colspan="3"><input name="prodimg2" id="prodimg2" size="30" type="file" />&nbsp;&nbsp;<img src="../images/products/<?=$_GET['prodid']?>-2.jpg?rand=<?=rand(1,1000); ?>" border="0" width="100" height="100" /></td>
                        </tr>
                      
                         <tr>
                          <td height="25" align="left">&nbsp;</td>
                          <td>&nbsp;</td>
                          <td align="left"><strong>Product Image3:</strong></td>
                          <td colspan="3"><input name="prodimg3" id="prodimg3" size="30" type="file" />&nbsp;&nbsp;<img src="../images/products/<?=$_GET['prodid']?>-3.jpg?rand=<?=rand(1,1000); ?>" border="0" width="100" height="100" /></td>
                        </tr>
                        
                        <tr>
                          <td height="25" align="left">&nbsp;</td>
                          <td>&nbsp;</td>
                          <td align="left"><strong>Product Image4:</strong></td>
                          <td colspan="3"><input name="prodimg4" id="prodimg4" size="30" type="file" />&nbsp;&nbsp;<img src="../images/products/<?=$_GET['prodid']?>-4.jpg?rand=<?=rand(1,1000); ?>" border="0" width="100" height="100" /></td>
                        </tr>
                        
                        <tr>
                          <td height="25" align="left">&nbsp;</td>
                          <td>&nbsp;</td>
                          <td align="left"><strong>Product Image5:</strong></td>
                          <td colspan="3"><input name="prodimg5" id="prodimg4" size="30" type="file" />&nbsp;&nbsp;<img src="../images/products/<?=$_GET['prodid']?>-5.jpg?rand=<?=rand(1,1000); ?>" border="0" width="100" height="100" /></td>
                        </tr>
                     
                          <tr>
                                    <td  align="left">&nbsp;</td>
                                    <td>&nbsp;</td>
                                    <td align="left"><strong>Related Products:</strong></td>
                                    <td colspan="3"><? 
									if($prod[relatedprods]!="")
							        {
									  $resquanprod=explode(',',$prod[relatedprods]);
									  $coount = count($resquanprod);
									}
						    $getprod_names = mysql_query("select pid,pname from products where pid != ".$_GET['prodid']);
							
						  ?>
                                      <select name="relatedprods[]" id="relatedprods" multiple="multiple">
                                        <? while($data_get = mysql_fetch_array($getprod_names)) { ?>
                                        <option value="<?=$data_get[pid]?>" <? for( $j=0;$j<$coount;$j++)
                        { ?> <?   if($resquanprod[$j] == $data_get[pid] )  { echo "Selected"; } ?> <? } ?>>
                                        <?=$data_get[pname]?>
                                        </option>
                                        <? } ?>
                                      </select>
                                    </td>
                                  </tr>
								  
                        <tr>
                          <td height="25" align="left">&nbsp;</td>
                          <td>&nbsp;</td>
                          <td><strong>print</strong></td>
                          
                          <td colspan="2">
                           
						  
						  Yes:
		  <input type="checkbox" name="checkbox" value="1" <?php if($prod["Print"] == 1) echo ("checked"); ?>/></td>
<td>
						  
						 
                          
                          </td> 
                          
                        </tr>
						<? 
											if($prod['unitsprice']!="") {
											$material=$prod['mini']; 
										 $str4=explode(',',$material); 
										 
										 $prodm=$prod['maxi']; 
										 $strmini=explode(',',$prodm); 
										 
										 $prodma=$prod['unitsprice']; 
										 $strmaxi=explode(',',$prodma); 
										  $cnt1=count($strmaxi);
																			
										for( $j=0;$j<$cnt1;$j++)
                                                     { 
										 ?>
										 
										 <tr>
                                         
                                    <td height="30" colspan="6" align="center">Min Qty :<input type='text'  id='min'  name='min[]' size=17   value="<? echo htmlspecialchars($str4[$j]); ?>">
                                      &nbsp;&nbsp;&nbsp;&nbsp;
                                      Pieces :
                                      <input type='text'  id='max'  name='max[]' size=17  value="<? echo htmlspecialchars($strmini[$j]); ?>">&nbsp;&nbsp;&nbsp;&nbsp;
                                      Price:<input type='text'  id='price'  name='price[]' size='5' onkeyup='return validatephone(this);' value="<? echo htmlspecialchars($strmaxi[$j]); ?>" >&nbsp;$<br><br>                                    </td>
                                  </tr>
					<!--	 <tr>
                                    <td width="10%" height="30" align="left"></td>
                                    <td width="20%"><label><strong>Min Qty</strong></label><input name="min[]" type="text" id="mini" size="17" value="<? echo htmlspecialchars($str4[$j]); ?>"  onkeyup="return validatephone(this)"/></td>
                                    <td width="16%"><label><strong></strong></label></td>
                                    <td width="20%"><label><strong>Max Qty:</strong></label><input name="max[]" type="text" id="maxi" size="17" value="<? echo htmlspecialchars($strmini[$j]); ?>"  onkeyup="return validatephone(this)"/></td>
                                    <td width="5%" align="left"></td>
                                    <td width="38%"><label><strong>Price:</strong></label><input type="text" name="price[]" size="5" id="price" value="<? echo htmlspecialchars($strmaxi[$j]); ?>" onkeyup="return validatephone(this)"  />
                                      $</td>
                                  </tr>--><? } } ?> <tr>
                                  <td height="76" align="left">&nbsp;</td>
                                    <td height="76" colspan="5" align="center" style="padding-left:120px;"><p id="parah1"  align="left"><span style="padding-left:160px;">Click below to add more.....</span></p>
                                    <a href="javascript:addInput();"><img src="images/addmore.gif" border="0" /></a></td>
                                    </tr>                        <tr>
                          <td height="25" align="left">&nbsp;</td>
                          <td>&nbsp;</td>
                          <td>&nbsp;</td>
                          <td colspan="2">
											  
						<input type="hidden" name="firstcnt" id="firstcnt" value="1"  />
                        <input type="hidden" name="secondcnt" id="secondcnt" value="1"  />
	<input type="hidden" name="catid" value="<?=$_GET['catid'] ?>">
	<input type="hidden" name="subcat" value="<?=$_GET['subcat']?>">
	<input type="hidden" name="prodid" value="<?=$_GET['prodid']?>"><input type="hidden" name="subsubcat" value="<?=$_GET['subsubcat']?>">
        <a href="<? echo $_SESSION['url'];?>"><img src="images/button_back.gif" border="o"/></a>
		 &nbsp;&nbsp;
		<input type="image" src="images/button_insert.gif" name="inserpr"/>
        &nbsp;&nbsp;
		<a href="<? echo $_SESSION['url'];?>"><img src="images/button_cancel.gif" border="o"/></a>	
		&nbsp;&nbsp;</td>
                          <td width="206">&nbsp;</td>
                          <td width="61">&nbsp;</td>
                        </tr>
						
                        <tr>
                          <td height="25" align="left">&nbsp;</td>
                          <td>&nbsp;</td>
                          <td>&nbsp;</td>
                          <td colspan="3">&nbsp;</td>
                        </tr>
                        <tr>
                          <td height="25" align="left">&nbsp;</td>
                          <td>&nbsp;</td>
                          <td>&nbsp;</td>
                          <td colspan="3">&nbsp;</td>
                        </tr>
                        <tr>
                          <td height="25" align="left">&nbsp;</td>
                          <td>&nbsp;</td>
                          <td>&nbsp;</td>
                          <td colspan="3">&nbsp;</td>
                        </tr>
                      </table>
					</form> 
					  
					  </td>
                    <td width="0%" valign="top"><!---->
                      
                      <!----></td>
                  </tr>
                </table></td>
              </tr>
              <tr>
                <td>&nbsp;</td>
              </tr>
            </table></td>
          </tr>
          <tr>
            <td>&nbsp;</td>
          </tr>

          <tr>
            <td><? require_once("footer.php"); ?></td>
          </tr>
          <tr>
            <td height="200">&nbsp; </td>
          </tr>
        </table></td>
      </tr>
    </table></td>
  </tr>
</table>
</body>
</html>
