<?php include('templates/header.php'); ?>
<?php include('templates/menu.php'); ?>

<?php
include "../db_function.php";  

$table="tbl_cate_clothes";

if(isset($_POST['submit'])){

$str9="SELECT id FROM $table ORDER BY id DESC LIMIT 1";
		$sql9=mysql_query($str9);
		while($row9=mysql_fetch_array($sql9)){
		$id=$row9['id'];
		}
		$id=$id+1;
		$cate=$_POST['cate'];
		
		$query="INSERT INTO $table values ('$id','0', '$cate')";
		$suc = mysql_query($query);
		if($suc){
				$masg=1;					
			}// end if
			else{
				$masg=0;
			}	
}	
?>

  <script>	
		$(document).ready(function() {
			// SUCCESS AJAX CALL, replace "success: false," by:     success : function() { callSuccessFunction() }, 
			
			$("#formID").validationEngine()						// CLOSE ALL OPEN PROMPTS
		});
	
	</script>

 
<!-- start content-outer -->
<div id="content-outer">
<!-- start content -->
<div id="content">


<div id="page-heading">
  <h1>Add New Category</h1></div>


<table border="0" width="100%" cellpadding="0" cellspacing="0" id="content-table">
<tr>
	<th rowspan="3" class="sized"><img src="images/shared/side_shadowleft.jpg" width="20" height="300" alt="" /></th>
	<th class="topleft"></th>
	<td id="tbl-border-top">&nbsp;</td>
	<th class="topright"></th>
	<th rowspan="3" class="sized"><img src="images/shared/side_shadowright.jpg" width="20" height="300" alt="" /></th>
</tr>
<tr>
	<td id="tbl-border-left"></td>
	<td>
		<div id="content-table-inner">
	<!--  start content-table-inner -->
	<?php
	if(isset($masg) && $masg==1 ){
	echo'
	<div id="message-green">
		<table border="0" width="100%" cellpadding="0" cellspacing="0">
		<tr>
			<td class="green-left">
				You added category: <b>'.$cate.'</b>.
			</td>
			<td class="green-right"><a class="close-green"><img src="images/table/icon_close_green.gif" alt="" /></a></td>
		</tr>
		</table>
	</div>';
	}
	else if(isset($masg) && $masg==0 ){
	echo'
	<div id="message-red">
		<table border="0" width="100%" cellpadding="0" cellspacing="0">
			<tr>
					<td class="red-left">Fail. Please try again.</td>
				<td class="red-right"><a class="close-red"><img src="images/table/icon_close_red.gif"   alt="" /></a></td>
			</tr>
		</table>
	</div>';
	}else if(isset($masg) && $masg==2){
	echo'
	<div id="message-yellow">
		<table border="0" width="100%" cellpadding="0" cellspacing="0">
			<tr>
					<td class="yellow-left">'.$change.'</td>
				<td class="yellow-right"><a class="close-yellow"><img src="images/table/icon_close_yellow.gif"   alt="" /></a></td>
			</tr>
		</table>
	</div>';
	}
	?>

	<table border="0" width="100%" cellpadding="0" cellspacing="0">
	<tr valign="top">
	<td>
	
		<!-- start id-form -->
	 <form name="form" id="formID" method="POST" action="" enctype="multipart/form-data">	
		<table border="0" cellpadding="0" cellspacing="0"  id="id-form">
        
		<tr>
			<th valign="top"><font class="note">* </font> Category Name :</th>
			<td><input type="text" class="validate[required] inp-form" id="cate" name="cate" /></td>
			<td></td>
		</tr>               
					
            <th>&nbsp;</th>
            <td valign="top"><br /><br />
                <input type="submit" value="" name="submit" class="form-submit" />
                <input type="reset" value="" class="form-reset"  />
            </td>
            <td></td>
		</tr>
		</table>
	<!-- end id-form  -->
	</form>
	</td>
	<td>

	<!--  start related-activities -->
	<div id="related-activities">
		
		<!--  start related-act-top -->
		<div id="related-act-top">
		<img src="images/forms/header_related_act.gif" width="271" height="43" alt="" />
		</div>
		<!-- end related-act-top -->
		
		<!--  start related-act-bottom -->
		<div id="related-act-bottom">
		
			<!--  start related-act-inner -->
			<div id="related-act-inner">
			
				<div class="left"><a href=""><img src="images/forms/icon_plus.gif" width="21" height="21" alt="" /></a></div>
				<div class="right">
					<h5><font color="red">Note</font></h5>
					 <font size="2">You must fill in
        the fields marked with a (<font color="red"> * </font>)
					</font>
					
				</div>
				
				
				<div class="clear"></div>
				<div class="lines-dotted-short"></div>
				
				<div class="left"><a href=""><img src="images/forms/icon_minus.gif" width="21" height="21" alt="" /></a></div>
				<div class="right">
					<font size="2"><h5>More problems</h5>
					If you have any problems please contact us :<br /><br />
					<font color="#4e4e4e"><b>- Designer : +855 81 6000 61<br />- Hotline &nbsp;&nbsp;&nbsp;: +855 23 994 119<br />
                    	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+855 23 5000 470<br />
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+855 23 63 64 678
                    </b></font>
					</font>
				</div>
				
				<div class="clear"></div>
				
			
				
			</div>
			<!-- end related-act-inner -->
			<div class="clear"></div>
		
		</div>
		<!-- end related-act-bottom -->
	
	</div>
	<!-- end related-activities -->

</td>
</tr>
<tr>
<td><img src="images/shared/blank.gif" width="695" height="1" alt="blank" /></td>
<td></td>
</tr>
</table>
 
<div class="clear"></div>
 

</div>
<!--  end content-table-inner  -->
</td>
<td id="tbl-border-right"></td>
</tr>
<tr>
	<th class="sized bottomleft"></th>
	<td id="tbl-border-bottom">&nbsp;</td>
	<th class="sized bottomright"></th>
</tr>
</table>









 





<div class="clear">&nbsp;</div>

</div>
<!--  end content -->
<div class="clear">&nbsp;</div>
</div>
<!--  end content-outer -->

 

<div class="clear">&nbsp;</div>
    
 <?php include('templates/footer.php'); ?>
  <?php 
if(isset($masg) && $masg==1 ){
 echo'
	<div id="mydiv" style="display:none;">
				<iframe src="addmoreimage?cate='.$category.'&id='.$id.'&name='.$title.'" width="800" height="440" style="border:0;" />
				</div>
';
}
?>