Location: PHPKode > projects > PHP Enter > www/admin/addcat.php
<?php include('header.php'); include('options.php'); ?>
<table width="90%" border="0" align="center" cellpadding="2" cellspacing="8" bgcolor="#FFFFFF">
<tr><td><strong>New Category</strong></td><tr>
<tr><td width="450px">
<?php
if(isset($_POST['submit']))
{
$parent = $_POST['parent'];
$name = $_POST['name'];
$result = mysql_query("INSERT INTO categori (parent, cord, name) VALUES ('$parent','0','$name')")
or die(mysql_error());  
echo"<br /><center><font size=2 color=green>Successfully.<br />";
echo "New Category ";
echo $name;
echo '</font></center>';
}else{
$query = mysql_query("SELECT MAX(catid) FROM `categori`");
$results = mysql_fetch_array($query);
$lastItemID = $results['MAX(catid)'] + 1;
//echo $lastItemID;
?>
<div id=vforms>
<form method="post" action="addcat.php">
Category Name: <input name="name" size="25">
<br /><br /><input type="hidden" name="parent" value="<?php echo $lastItemID ?>">
<br /><br /><INPUT TYPE="Submit" name="submit" VALUE=" Submit">
</td></tr>
</form>
</td></tr></table>
<?php } ?>
</td></tr>
</table>


  
Return current item: PHP Enter