D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home3
/
encodto1
/
salvation.incrediblebengal.com
/
admin
/
Filename :
edit-restaurent.php
back
Copy
<?php include'config.php'; include'get_session_access.php'; $page_title = "Update Restaurent Info"; $restro_id = $_GET["id"]; $show_item = "SELECT * FROM restro_details"; $run_query = mysqli_query($conn, $show_item); ?> <!DOCTYPE html> <html lang="en"> <head> <title>Encode Restaurent - Admin Dashboard </title> <?php include'style.php'; ?> </head> <body> <div id="main-wrapper"> <?php include'header.php'; ?> <?php include'sidebar.php'; ?> <!--********************************** Content body start ***********************************--> <div class="content-body"> <!-- row --> <div class="container-fluid"> <div class="row page-titles mx-0"> <div class="col-sm-6 p-md-0"> <div class="welcome-text"> <h4>Update Restaurent Info</h4> </div> </div> <div class="col-sm-6 p-md-0 justify-content-sm-end mt-2 mt-sm-0 d-flex"> <ol class="breadcrumb"> <li class="breadcrumb-item"><a href="javascript:void(0)">Update Restaurent Info</a></li> <li class="breadcrumb-item active"><a href="admin-panel.php">Dashboard</a></li> </ol> </div> </div> <!-- row --> <div class="row gx-1"> <div class="col-xl-6 col-lg-6"> <div class="card"> <div class="card-body"> <div class="basic-form staff_profile"> <?php $row = mysqli_fetch_array($run_query) ?> <form action="" method="POST" enctype="multipart/form-data"> <div class="form-group"> <label class="form_label">Restaurent Name..</label> <input type="text" class="form-control" name="restro_name" value="<?php echo $row['restro_name']; ?>"> </div> <div class="form-group"> <label class="form_label">Date Of Opening</label> <input type="date" class="form-control" name="restro_opening" value="<?php echo $row['restro_opening']; ?>"> </div> <div class="form-group"> <label class="form_label">Contact Number</label> <input class="form-control" type="tel" maxlength="10" name="restro_phone" value="<?php echo $row['restro_phone']; ?>"> </div> <div class="form-group"> <label class="form_label">Contact Number(2)</label> <input class="form-control" type="tel" maxlength="10" name="restro_phone2" value="<?php echo $row['restro_phone2']; ?>"> </div> <div class="form-group"> <label class="form_label">Restaurent Email Id</label> <input class="form-control" type="email" name="restro_email" value="<?php echo $row['restro_email']; ?>"> </div> <div class="form-group"> <label class="form_label">City</label> <input class="form-control" type="text" name="restro_city" value="<?php echo $row['restro_city']; ?>"> </div> <div class="form-group"> <label class="form_label">Full Address</label> <input class="form-control" type="text" name="restro_address" value="<?php echo $row['restro_address']; ?>"> </div> <div class="form-group"> <label class="form_label">Owner Name</label> <input class="form-control" type="text" name="restro_owner" value="<?php echo $row['restro_owner']; ?>"> </div> <div class="form-group"> <label class="form_label">Owner Mobile No.</label> <input class="form-control" type="tel" maxlength="10" name="restro_owner_phone" value="<?php echo $row['restro_owner_phone']; ?>"> </div> <div class="form-group"> <label class="form_label">Owner Address</label> <input class="form-control" type="text" name="restro_owner_address" value="<?php echo $row['restro_owner_address']; ?>"> </div> <div class="form-group"> <label class="form_label">Owner City</label> <input class="form-control" type="text" name="restro_owner_city" value="<?php echo $row['restro_owner_city']; ?>"> </div> <div class="form-group"> <label class="form_label">Restaurent GST No.</label> <input class="form-control" type="text" name="restro_gst" value="<?php echo $row['restro_gst']; ?>"> </div> <div class="form-group"> <img class="editable_img" id="editItem" src="images/<?php echo $row['restro_logo']; ?>" style="height: 150px;width:200px;"> <label class="form_label">restaurent Logo</label> <input class="form-control" type="file" name="restro_logo" src="images/<?php echo $row['restro_logo']; ?>" onchange="loadFile(event)"> </div> <div class="form-group"> <input class="bttn bttn-submit" type="submit" name="edit_restro" value="Edit Restaurent"> </div> </form> </div> </div> </div> </div> </div> </div> </div> <!--********************************** Content body end ***********************************--> <?php include'footer.php'; ?> <script type="text/javascript"> var loadFile = function(event) { var image = document.getElementById('editItem'); image.src = URL.createObjectURL(event.target.files[0]); }; </script> </body> </html> <?php if (isset($_POST['edit_restro'])) { $restro_name = $_POST['restro_name']; $restro_opening = $_POST['restro_opening']; $restro_email = $_POST['restro_email']; $restro_phone = $_POST['restro_phone']; $restro_phone2 = $_POST['restro_phone2']; $restro_city = $_POST['restro_city']; $restro_address = $_POST['restro_address']; $restro_owner = $_POST['restro_owner']; $restro_owner_phone = $_POST['restro_owner_phone']; $restro_owner_address = $_POST['restro_owner_address']; $restro_owner_city = $_POST['restro_owner_city']; $restro_gst = $_POST['restro_gst']; if (!empty($_FILES['restro_logo']['name'])) { unlink('images//'.$restro_logo); $uploaddir = 'images'; $restro_logo = $_FILES['restro_logo']['name']; $tmp_restro_logo = $_FILES['restro_logo']['tmp_name']; $restro_logo_path = $uploaddir ."/". $restro_logo; move_uploaded_file($tmp_restro_logo, $restro_logo_path); } $edit_staff_query = "UPDATE restro_details SET `restro_name` ='$restro_name',`restro_opening`='$restro_oening',`restro_phone`='$restro_phone',`restro_phone2`='$restro_phone2',`restro_email`='$restro_email',`restro_city`='$restro_city',`restro_address`='$restro_address',`restro_owner`='$restro_owner',`restro_owner_phone`='$restro_owner_phone',`restro_owner_address`='$restro_owner_address',`restro_owner_city`='$restro_owner_city',`restro_gst`='$restro_gst',`restro_logo`='$restro_logo' WHERE `restro_id`='$restro_id'"; $run_staff_query = mysqli_query($conn, $edit_staff_query); if ($run_staff_query) { echo '<script>window.location.href="restaurent-details.php";</script>'; } else{ echo '<script>alert("Oops! not updated successfully.")</script>'; } } ?>