File manager - Edit - /home/custbahd/irungikitchen.com/admin1/search/add/index.php
Back
<?php session_start(); include_once('../../db/connection.php'); if(isset($_POST['add'])){ $name = $_POST['name']; $cat = $_POST['cat']; $sub = $_POST['sub']; $type = $_POST['type']; $gender = $_POST['gender']; $size = $_POST['size']; $genre = $_POST['genre']; $package = $_POST['package']; $original_price = $_POST['original_price']; $price = $_POST['price']; if ($_POST['original_price']=='') { $discount = ''; } else { //Discount = 100 * (Original Price - Discount Price) / Original Price. $discount = round(100 * ($original_price - $price) / $original_price, 2); } $instock = $_POST['instock']; $outstock = $_POST['outstock']; $image = $_FILES['image']['name']; $target = "../../images/".basename($_FILES['image']['name']); $sql = "INSERT INTO shop (name, cat, sub, type, gender, size, genre, package, image, original_price, price, discount, instock, outstock) VALUES ('$name','$cat','$sub','$type','$gender','$size','$genre','$package','$image','$original_price','$price','$discount','$instock','$outstock')"; if (move_uploaded_file($_FILES['image']['tmp_name'], $target)); //use for MySQLi OOP if($conn->query($sql)){ $_SESSION['success'] = 'Item added successfully'; } else{ $_SESSION['error'] = 'Something went wrong while adding'; } } header('location: ../../'); ?>
| ver. 1.4 |
Github
|
.
| PHP 8.1.33 | Generation time: 4 |
proxy
|
phpinfo
|
Settings