summaryrefslogtreecommitdiff
path: root/add_user.php
blob: 652de82032c7bae18a3a665cd6593ee30138bbab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<!DOCTYPE html>
<html lang="en">
<head>
    <title>Qarz daftarcha</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/css/bootstrap.min.css">
    <script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.slim.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/js/bootstrap.bundle.min.js"></script>
</head>
<body>

<div class="container mt-5">
    <h2>Qoshish</h2>
    <form method="post" action="">
        <div class="form-group">
            <label for="ism">Ism:</label>
            <input type="text" class="form-control" id="ism" placeholder="Jahongir" name="ism" required>
            <label for="telefon_nomer">Telefon nomer:</label>
            <input type="number" class="form-control" id="telefon_nomer" placeholder="998907477777" name="telefon_nomer" required>
            <label for="miqdor">Qarz:</label>
            <input type="number" min="0" class="form-control" id="miqdor" placeholder="10000" name="miqdor" required>
	</div>
        <button type="submit" class="btn btn-primary">Saqlash</button>
    </form>
</div>

<?php

include "get_users.php";

if (array_key_exists("ism", $_POST)) {
    $ism = $_POST["ism"]; 
    $telefon_nomer = $_POST["telefon_nomer"]; 
    $miqdor = $_POST["miqdor"]; 
    $sql = "INSERT INTO qarzdorlar (ism, telefon_nomer, miqdor) VALUES ('$ism', $telefon_nomer,$miqdor)";
    $result = $conn->query($sql);
    
    if ($result === TRUE) {
	    header("Location: index.php");
    } else {
	    echo "Error: " . $sql . "<br>" . $conn->error;
    }
}

?>

</body>
</html>