PHP Code Snippet Library
Available Snippets
+ Affichage

+ PHP_CSL_6

 + Snips_Add

 + Cats_Edit

 + Menu

 + Cats_Delete

 + Middle

 + Cats_Add

 + Snips_Delete

 + README

 + Index

 + Snips_Edit

 + Configuration

 + Classes

+ String_manipulation

+ Variables

Generic Options
+   Main page

+   Add new snippet

+   Add new category

+   Edit a category

+   Delete a category

Unique Options
+   Edit this snippet

+   Delete this snippet

+   Edit this category

+   Delete this category

Syntax for: PHP_CSL_6 . Cats_Add
<?
if(isset($_POST['add_snip_form'])) {
    if(
cats_add($_POST['new_cat'])) {
        echo 
'<br><div align=center><b>Category Added !!</b></br>';
        echo 
'<a href=index.php>click here to refresh and see changes.</a></br></div>';
        echo 
'<script language=javascript>
        alert("Category Added");
        document.location="index.php";
        </script>'
;
    } else {
        echo 
'some type of error happend, probably that a category with that name already exists</br>';
    }
}


echo 
'</br><form action='.$_SERVER["PHP_SELF"].'?'.$_SERVER["QUERY_STRING"].' method=post>';
echo 
'<table align=center class=table1 cellpadding=6><tr class=rowpic><td colspan=2>Add new category</td></tr><tr><td>';
echo 
'Category title:</td><td><input type=text name=new_cat></td></tr><tr align=center><td colspan=2>';
echo 
'<input type=submit class=submit name=add_snip_form value=submit></td></tr>';
echo 
'<input type=hidden name=op value='.$_GET['op'].'>';
echo 
'</table>';
?>
 
Description for: PHP_CSL_6 . Cats_Add
Add a new Category