<?php
// Check if the form is submitted
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    // Connect to your database (you should replace these with your actual database credentials)
   include('connection.php');

    // Retrieve data from the form
    $id = $_POST['id'];
    $company_name = $_POST['company_name'];
    $company_website = $_POST['company_website'];
    $concern_person = $_POST['concern_person'];
    $contact_number = $_POST['contact_number'];
    $email = $_POST['email'];
    $service = $_POST['service'];
    $rate = $_POST['rate'];
    $service_url = $_POST['service_url'];
    $Username = $_POST['Username'];
    $password = $_POST['password'];

    // Update the database record
    $sql = "UPDATE add_panel
            SET company_name = '$company_name',
                company_website = '$company_website',
                concern_person = '$concern_person',
                contact_number = '$contact_number',
                email = '$email',
                service = '$service',
                rate = '$rate',
                service_url = '$service_url',
                Username = '$Username',
                password = '$password'
                WHERE id = $id";

    if ($conn->query($sql) === TRUE) {
        // Redirect to a success page or do something else after successful update

        header("Location: view-all-other-panel.php");

        exit();
    } else {
        echo "Error: " . $sql . "<br>" . $conn->error;
    }

    $conn->close();
}
?>