Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <h1>HOP create catogory</h1>
- <h3 class="title">create new category</h3>
- <p>CRUD demonstration for final exam by Snezana Ilic</p>
- <?php
- require_once 'conn.php'; // establish db connection
- $cattype = filter_input(INPUT_POST, 'cat_type') or die(' fejl i cat_type');
- $sql = 'INSERT INTO wp2_category ( cat_type ) VALUES ( ? )';
- $stmt = $link->prepare($sql);
- $stmt->bind_param('s', $cattype);
- $stmt->execute();
- header('location:hop-admin-create.php');
- //echo 'inserted resource name '.$cattype.' as id:'.($stmt->insert_id); // id for inserted record
- ?>
- <?php
- $pageTitle = "Create category";
- require_once 'conn.php';
- $form_submit === FALSE;
- ?>
- <h2>Create category</h2>
- <?php if($form_submit === FALSE){ ?>
- <form action="" method="post">
- Category name* <br>
- <input type="text" name="cat_type" value=""><br>
- <br>
- <input type="submit" name="submitcreate" value="Add new gategory">
- </form>
- <?php
- }else{
- require_once 'conn.php'; // establish db connection
- $cattype = filter_input(INPUT_POST, 'cat_type') or die(' fejl i cat_type');
- $sql = 'INSERT INTO wp2_category ( cat_type ) VALUES ( ? )';
- $stmt = $link->prepare($sql);
- $stmt->bind_param('s', $cattype);
- $stmt->execute();
- //header('location:hop-admin-create.php');
- //echo 'inserted resource name '.$cattype.' as id:'.($stmt->insert_id); // id for inserted record
- $pageTitle = "Create category";
- require_once 'conn.php';
- ?>
- <h2>Create category</h2>
- <form action="" method="post">
- Category name* <br>
- <input type="text" name="cat_type" value="create">
- <br>
- <input type="submit" name="submitcreate" value="Add new gategory">
- </form>
- <?php
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement