<? 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" />
<?php include_once("title.php");?>
<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>

<script language="javascript" type="text/javascript" src="tiny_mce/tiny_mce_src.js"></script>
<script type='text/javascript'>

   tinyMCE.init({
		// General options
		mode : "textareas",
		theme : "advanced",
		plugins : "safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",

		// Theme options
		theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",
		theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
		theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
		theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak",
		theme_advanced_toolbar_location : "top",
		theme_advanced_toolbar_align : "left",
		theme_advanced_statusbar_location : "bottom",
		theme_advanced_resizing : true,

		// Example content CSS (should be your site CSS)
		content_css : "css/content.css",

		// Drop lists for link/image/media/template dialogs
		template_external_list_url : "lists/template_list.js",
		external_link_list_url : "lists/link_list.js",
		external_image_list_url : "lists/image_list.js",
		media_external_list_url : "lists/media_list.js",

		// Replace values for the template plugin
		//template_replace_values : {
			//username : "Some User",
			//staffid : "991234"
		//}
	});
</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="165"><label><strong>Product Name:</strong></label></td>
                          <td  colspan="3"><input type="text" name="pname" size="30" value="<?=stripcslashes($prod['pname'])?>" /> </td>
                        </tr>
                        
                        
						 
								    <tr>
                                    <td height="30" align="left">&nbsp;</td>
                                    <td>&nbsp;</td>
                                    <td><strong>Weight:</strong></td>
                                    <td  colspan="3"><input name="weight" type="text" id="weight" value="<?=$prod['weight']?>" size="30"  /> 
                                    lbs</td>
                                  </tr>
								  	
                                
                                  <tr>
							   <td height="34">&nbsp;</td>
							   <td>&nbsp;</td>
							   <td><strong>Price:</strong></td>
							   <td width="408"><input type="text" name="price" value="<?php echo $prod['price'];?> " />&nbsp; $</td>
							   </tr>
                              
								  <tr>
                                  <td height="34">&nbsp;</td>
							   <td>&nbsp;</td>
							   <td><strong>Color:</strong></td>
							   <td width="408"><input name="color" type="text" id="color" value="<?php echo $prod['color'];?> " size="30" />
							   &nbsp;</td>
							   </tr>
								    <tr>
							   <td height="34">&nbsp;</td>
							   <td>&nbsp;</td>
							   <td><strong> Size:</strong></td>
							   <td width="408"><input name="size" type="text" id="size" value="<?php echo $prod['size'];?> " size="30" />
							   &nbsp;</td>
							   </tr>
                              
                                  
                           
                               
						<tr>
                          <td width="100" height="30" align="left">&nbsp;</td>
                          <td width="60">&nbsp;</td>
                          <td width="165"><label><strong>Description:</strong></label></td>
                          <td  colspan="3"><textarea name="description" rows="20" cols="75" /><?=$prod['description']?></textarea>
                        
                          </td>
                        </tr>
                          <tr>
							  
							   <td colspan="6">&nbsp;</td>
							  
							   </tr>
                        	<tr>
                          <td width="100" height="30" align="left">&nbsp;</td>
                          <td width="60">&nbsp;</td>
                          <td width="165"><label><strong>Specifications:</strong></label></td>
                          <td  colspan="3">
                          <textarea name="specifications" cols="75" rows="20" id="specifications" /><?=$prod['specifications']?></textarea>
                        
                          </td>
                        </tr>
                       
                      
						
						<tr>
                          <td width="100" height="30" align="left">&nbsp;</td>
                          <td width="60">&nbsp;</td>
                          <td width="165"><label><strong>Product Image1:</strong></label></td>
                          <td  colspan="3"><input type="file" name="prodimg1" size="30" />&nbsp;&nbsp;<img src="../products/small/<?=$_GET['prodid']?>-1.jpg?rand=<?=rand(1,1000); ?>" border="0"  /></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="../products/small/<?=$_GET['prodid']?>-2.jpg?rand=<?=rand(1,1000); ?>" border="0"  /></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="../products/small/<?=$_GET['prodid']?>-3.jpg?rand=<?=rand(1,1000); ?>" border="0"  /></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="../products/small/<?=$_GET['prodid']?>-4.jpg?rand=<?=rand(1,1000); ?>" border="0"/></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="../products/small/<?=$_GET['prodid']?>-5.jpg?rand=<?=rand(1,1000); ?>" border="0"  /></td>
                        </tr>
                         <tr>
                          <td height="25" align="left">&nbsp;</td>
                          <td>&nbsp;</td>
                          <td align="left"><strong>Product Image6:</strong></td>
                          <td colspan="3"><input name="prodimg6" id="prodimg6" size="30" type="file" />&nbsp;&nbsp;<img src="../products/small/<?=$_GET['prodid']?>-6.jpg?rand=<?=rand(1,1000); ?>" border="0"  /></td>
                        </tr>
                    
                          <?php /*?><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><?php */?>
								  <tr>

                                    <td height="25" align="left">&nbsp;</td>

                                    <td>&nbsp;</td>

                                    <td align="left"><strong>Feature Product:</strong></td>

                        <td colspan="3"><input type="checkbox" name="new" value="1" <?php if($prod['new']==1) echo ("checked"); ?>/></td>

                                  </tr>
                        <?php /*?><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><?php */?>
						<? 
											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++)
                                                     { 
										 ?>
										 
										 <?php /*?><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><?php */?>
						 <?php /*?><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><?php */?><? } } ?> <?php /*?><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><?php */?>                        <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']?>">
        <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>
