Sid Gifari File Manager
🏠Root
/
home
/
u527040259
/
domains
/
techamber.in
/
.trash
/
📝 Editing: edit-product.php
<?php include '../conn.php'; if(isset($_GET['id'])) { $id = $_GET['id']; $sql = "SELECT * FROM `products` WHERE `id` = $id"; $query = mysqli_query($con, $sql); $row = mysqli_num_rows($query); if($row==1) { $detail = mysqli_fetch_assoc($query); $title = $detail['title']; $length = $detail['length_cm']; $breadth = $detail['breadth_cm']; $height = $detail['height_cm']; $itemnumber = $detail['item_number']; $des = $detail['description']; $cat = $detail['category']; $status = $detail['status']; } else { echo'<script>alert("Something Went Wrong")</script>'; header("location: products-admin.php"); } } else { header("location: products-admin.php"); } if(isset($_POST['btn'])) { $title = $_POST['title']; $length = $_POST['l']; $breadth = $_POST['b']; $height = $_POST['h']; $size_in = $_POST['size_in']; $subcat = $_POST['sub-cat']; $item_number = $_POST['item_number']; $status = $_POST['status']; $des = $_POST['des']; $sqli="SELECT * FROM `subcategory` WHERE `title` = '$subcat'"; $result = mysqli_query($con, $sqli); $row=mysqli_fetch_assoc($result); $category = $row['parent']; $sql="UPDATE `products` SET `title`='$title',`item_number`='$item_number',`description`='$des',`category`='$category',`sub-category`='$subcat',`length_cm`='$length', `breadth_cm`='$breadth', `height_cm`='$height', `status`='$status'"; $result=mysqli_query($con, $sql); if($result) { echo'<script>alert("Product Updated")</script>'; // header('location: products-admin.php'.$theme); } else { echo'<script>alert("Something Went Wrong")</script>'; } } $light_mode = ".formp,form{background-color:#fff}.sbutton,form #title{background-color:#00000000}.sbutton,body{font-family:Quicksand,sans-serif}.center,h1{text-align:center}.flex,.formp{display:flex}body,form #title,input,select,textarea{width:100%}body{margin:0;padding:0;overflow-x:hidden;height:100%}.lbh,select{height:30px}.formp{width:100vw;justify-content:center;align-items:center}form{padding:30px;border-radius:10px;width:80%}form #title{margin-bottom:20px;outline:0;border:none;border-bottom:1px solid #000}h1{color:#c60000}.sbutton,label{color:#000;font-size:20px;text-transform:capitalize}.sbutton{outline:0!important;border:none!important;background-color:#ddd;padding:10px 30px 12px;border-radius:50px;margin-top:30px;transition:.3s}.cross,input,select{outline:0}.sbutton:hover{background-color:#c60000;color:#fff;border-radius:5px}#error{color:red}input{border-radius:2px;border:1px solid #000}input[type=file]{border-radius:5px;width:100%;height:35px;border:none}.flex{justify-content:center}select{border:1px solid #000}textarea{height:200px;background:#00000000}.eximg{width:200px!important}.cross{background-color:#00000000;border:none;position:absolute;margin-left:-40px;margin-top:10px;transition:.3s;color:#ea8910}.lbh{width:30%}"; $dark_mode = "body {margin: 0;padding: 0;overflow-x:hidden;background-color:#181818;font-family: 'Quicksand', sans-serif;}.formp {background-color: #181818;width: 100vw;height: fit-content;display: flex;justify-content: center;align-items: center;}form {background-color: #181818;padding: 30px;border-radius: 10px;width: 80%;}form #title {width: 100%;background-color: #00000000;margin-bottom: 20px;outline: none;border:none;color:#fff;border-bottom: 1px solid #fff;}h1 {color: #c60000;text-align: center;}label {font-size: 20px;color: #fff;text-transform: capitalize;}button {background-color:#00000000;outline: none !important;border:none !important;color:#fff;font-size:20px;background-color:#000;padding:10px 30px 12px 30px;border-radius:50px;font-family: 'Quicksand', sans-serif;text-transform:capitalize;margin-top:30px;transition:.3s;}button:hover {background-color:#c60000;color:#fff;border-radius:5px;}.center {text-align:center;}#error {color:red;}input {outline:none;border-radius:2px;border:2px solid #fff;width:100%;background-color:#000000;color:#fff;}input[type=file] {border-radius:5px;width:100%;height:35px;border:none;background-color:#00000000;}.flex {display:flex;justify-content:center;}select {width:100%;outline:none;border:1px solid #fff;background-color:#000;color:#fff;}textarea {width:100%;height:200px;color:#fff;border:2px solid #fff;background:#000000;}select {width:100%;outline:none;border:1px solid #000;height:30px;}.lbh {width:30%;height:30px;}"; if(isset($_GET['theme'])) { $css= $dark_mode; $theme='?theme=dark'; } else { $css= $light_mode; $theme=' '; } ?> <!DOCTYPE html> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD" crossorigin="anonymous"> <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200"/> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Add Products | Ali Metal</title> </head> <style> @import url('https://fonts.googleapis.com/css2?family=League+Spartan:wght@800&display=swap'); @import url('https://fonts.googleapis.com/css2?family=Quicksand:wght@500&display=swap'); <?php echo $css ?> /* body { margin: 0; padding: 0; overflow-x:hidden; height:100%; width:100%; background-color:#181818; font-family: 'Quicksand', sans-serif; } .formp { background-color: #181818; width: 100vw; display: flex; justify-content: center; align-items: center; } form { background-color: #181818; padding: 30px; border-radius: 10px; width: 80%; } form #title { width: 100%; background-color: #00000000; margin-bottom: 20px; outline: none; border:none; border-bottom: 1px solid #000; } h1 { color: #c60000; text-align: center; } label { font-size: 20px; color: #000; text-transform: capitalize; } .sbutton { background-color:#00000000; outline: none !important; border:none !important; color:#000; font-size:20px; background-color:#ddd; padding:10px 30px 12px 30px; border-radius:50px; font-family: 'Quicksand', sans-serif; text-transform:capitalize; margin-top:30px; transition:.3s; } .sbutton:hover { background-color:#c60000; color:#fff; border-radius:5px; } .center { text-align:center; } #error { color:red; } input { outline:none; border-radius:2px; border:1px solid #000; width:100%; } input[type=file] { border-radius:5px; width:100%; height:35px; border:none; } .flex { display:flex; justify-content:center; } select { width:100%; outline:none; border:1px solid #000; height:30px; } textarea { width:100%; height:200px; background:#00000000; } .eximg { width:200px !important; } .cross { background-color:#00000000; outline:none; border:none; position:absolute; margin-left:-40px; margin-top:10px; transition:.3s; color:#ea8910; } .lbh { width:30%; height:30px; } */ </style> <body> <div class="formp"> <form action="" method="POST" enctype="multipart/form-data"> <h1>Edit Product</h1> <div class="row"> <div class="col-lg-6 col-md-12"><br> <label for="">title</label><br> <input type="text" name="title" class="tp" value="<?php echo $title; ?>" required><br> </div> <div class="col-lg-4 col-md-12"><br> <label for="">Size (in centimeters)</label><br> <div class="d-flex justify-content-between"> <input type="number" name="l" class="tp lbh" placeholder="Length" value="<?php echo $length; ?>" required><br> <input type="number" name="b" class="tp lbh" placeholder="breadth" value="<?php echo $breadth; ?>" required><br> <input type="number" name="h" class="tp lbh" placeholder="height" value="<?php echo $height; ?>" required><br> </div> </div> <?php $sql="select `title` from `subcategory`"; $query= mysqli_query($con, $sql); ?> <div class="col-lg-6 col-md-12"><br> <label for="">select category</label><br> <select name="sub-cat" required id="cat"> <?php while($row = mysqli_fetch_assoc($query)) { if($row['title']==$cat) { echo '<option value="'.$row['title'].'" selected>'.$row['title'].'</option>'; } echo '<option value="'.$row['title'].'">'.$row['title'].'</option>'; } ?> </select> </div> <br> <div class="col-lg-6 col-md-6"><br> <label for="">Item Number</label><br> <input type="number" name="item_number" value="<?php echo $itemnumber; ?>" class="rp" required><br> </div> <div class="col-lg-6 col-md-12"><br> <label for="">Status</label><br> <select name="status" required> <?php if($status=="public") { echo '<option value="public" selected>Public</option>'; echo '<option value="private">Private</option>'; } else { echo '<option value="private" selected>Private</option>'; echo '<option value="public">Public</option>'; } ?> </select> </div> <div class="col-lg-12 col-md-12"><br> <label for="">Description</label><br> <textarea name="des" ><?php echo $des; ?></textarea> </div> </div> <button type="submit" name="btn" class="sbutton">Edit Product</button> </form> </div> </body> <script src="../js/app.js"></script> </html>
đź’ľ Save
❌ Cancel
Sid Gifari File Manager v1.0 | Terminal Auto-Sync Enabled | Current Path: /home/u527040259/domains/techamber.in/.trash