init
This commit is contained in:
56
119/create-category.php
Normal file
56
119/create-category.php
Normal file
@@ -0,0 +1,56 @@
|
||||
<div>
|
||||
<form method="POST">
|
||||
<br>
|
||||
<label for="category">Category:
|
||||
<input type="text" name="category"/><br>
|
||||
</label><br>
|
||||
<br>
|
||||
|
||||
<br>
|
||||
<input type="submit" value="Creat Category">
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
<?php
|
||||
if(isset($_POST['category'])){
|
||||
$link = new mysqli(MYSQL_HOST,MYSQL_USER,MYSQL_PASS,MYSQL_DB);
|
||||
$link->set_charset("utf8");
|
||||
$query="INSERT INTO `".SHOP_ID."_cat` ( `category`)VALUES(?)";
|
||||
$stmt = $link->prepare($query);
|
||||
if($stmt){
|
||||
$stmt->bind_param("s", $_POST['category'] );
|
||||
//if(!$stmt->execute()) echo '<div class="alert alert-danger">' . mysqli_error($link) . '</div>';
|
||||
if(!$stmt->execute()) echo '<div class="alert alert-danger">' . mysqli_error($link) . '</div>';
|
||||
else {
|
||||
|
||||
echo '<div class="alert alert-success"> '.$_POST['category'].' added as a new category </div> <br> ';
|
||||
}
|
||||
}
|
||||
else echo mysqli_error($link);
|
||||
|
||||
|
||||
|
||||
$link->close();
|
||||
|
||||
|
||||
}
|
||||
// $stmt = $link->prepare("INSERT INTO ".MYSQL_TB13." (`batch`, `std_name`, `tchr_name`)VALUES(?,?,?)");
|
||||
// if($stmt){
|
||||
// $stmt->bind_param("sss", $batch,$student,$teacher);
|
||||
// //if(!$stmt->execute()) echo '<div class="alert alert-danger">' . mysqli_error($link) . '</div>';
|
||||
// if(!$stmt->execute()) echo '<div class="alert alert-danger">' . mysqli_error($link) . '</div>';
|
||||
// else {
|
||||
// echo '<div class="alert alert-success">Student Register Successfull </div> <br> <a href="'.$_SERVER['REQUEST_URI'].'"> Add Another</a>';
|
||||
// }
|
||||
// }
|
||||
// else echo mysqli_error($link);
|
||||
|
||||
|
||||
|
||||
// $link->close();
|
||||
|
||||
// }
|
||||
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user