<?php
/* include db connection file */
include("connection.php");

if(isset($_POST['submit'])){
    /* capture values from HTML form */
    $id = $_POST['ID'];
    $pass = $_POST['Pass'];
    $name = $_POST['Name'];
    $phonenum = $_POST['PhoneNum'];
    $age = $_POST['Age'];
    $email = $_POST['Email'];

    // Insert into user table
    $sql = "INSERT INTO renter (Renter_ID,Renter_Pass,Renter_Name,Renter_PhoneNum,Renter_Age,Renter_Email) VALUES ('$id','$pass','$name','$phonenum','$age','$email')";

    $result = mysqli_query($conn, $sql);

    if ($result) {
        echo "<script>alert('Sign In Successfull')</script>";
        echo "<script>window.location = 'login.html'</script>";
    } else {
        echo "<script>alert('Renter ID is already exist or error type entering')</script>";
        echo "<script>window.location = 'signin.html'</script>";
    }
    
    mysqli_close($conn); // Close connection
}
?>
