<?php

session_start(); 
    $u_uname = '';
    if (isset($_COOKIE['auth_token']))
    {
        $u_uname = $_COOKIE['auth_token'];
    }else{
        header("location:../login.php");
    }
    
    
    include('../include/connection.php');

    $clientName = $_POST['clientName'];
    $clientPhone = $_POST['clientPhone'];
    $server_amount = $_POST['server_amount'];
    $client_whatsapp_number = $_POST['client_whatsapp_number'];
    $clientEmail = $_POST['clientEmail'];
    $deliveryDate = $_POST['deliveryDate'];
    $customerId= $_POST['customerId'];
    $serverType = $_POST['servertype'];
    $validity = $_POST['validity'];

    $id = $_GET['id'];

    $sql = "UPDATE `servers` SET `clientName`='$clientName',`clientPhone`=$clientPhone,`server_amount`='$server_amount',`client_whatsapp_number`='$client_whatsapp_number',`clientEmail`='$clientEmail', `delivery_date`='$deliveryDate', `customer_id`='$customerId',`server_type`='$serverType',`validity`='$validity' WHERE id='$id'";

    $serverUpdate = $link->query($sql);
    if($serverUpdate){
        header('Location:../serverhistory.php?status=3');
    }
    
?>