<?php
session_start();
?>
<!DOCTYPE html>
<html>

<head>
    <title>Polytical Edge | Add User</title>
    <?php include 'css.php';
	include './assets/database/fetch.php'; ?>
</head>

<body>
    <div class="main-wrapper">
        <?php $currentPage = 'basic-element';
		include 'sidebar.php'; ?>
        <div class="page-wrapper">
            <?php include 'header.php'; ?>
            <div class="page-content">
                <div class="row">
                    <div class="col-md-12 grid-margin stretch-card">
                        <div class="card add-row">
                            <div class="card-body">
                                <h6 class="card-title">Add User</h6>
                                <form class="forms-sample" method="POST" action="">
                                    <div class="form-group">
                                        <label for="name">Name</label>
                                        <input id="name" class="form-control" name="name" type="text">
                                    </div>
                                    <div class="form-group">
                                        <label for="email">Email</label>
                                        <input id="email" class="form-control" placeholder="someone@email.com"
                                            name="email" type="email">
                                    </div>
                                    <div class="form-group">
                                        <label for="role">Role</label>
                                        <select name="role" id="role">
                                            <option value="Admin">Adimn</option>
                                            <option value="Viewer">Viewer</option>
                                        </select>
                                    </div>
                                    <div class="form-group">
                                        <label for="mobile">Mobile No.</label>
                                        <input id="mobno" class="form-control" name="mobno" type="number">
                                    </div>
                                    <!-- <div class="form-group">
											<label for="password">Password</label>
											<input id="password" class="form-control" name="password" type="password">
										</div>
										<div class="form-group">
											<label for="confirm_password">Confirm password</label>
											<input id="confirm_password" class="form-control" name="confirm_password" type="password">
										</div> -->
                                    <input class="btn btn-primary" type="submit" name="submit" value="Submit">
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <?php include 'footer.php'; ?>
            <?php include 'js.php'; ?>
        </div>
    </div>
    <?php
	if (isset($_POST["submit"])) {
		$conn = connect_database();
		$name = $_POST["name"];
		$email = $_POST["email"];
		$mobno = $_POST["mobno"];
		$password = md5('password');
		$role = $_POST["role"];
		$sql = "INSERT INTO `User`(`Name`, `Email`, `Phone_Number`, `Password`, `Role`) 
		VALUES ('" . $name . "','" . $email . "','" . $mobno . "','" . $password . "','" . $role . "')";
		// echo $sql;
		echo "<script>alert('hello')</script>";
		$conn->query($sql);
		$conn->close();
		// insert_report(2, 'mansa');
	}
	?>

</body>

</html>