Skip to content

Instantly share code, notes, and snippets.

@sinyo1015
Created November 20, 2020 14:31
Show Gist options
  • Save sinyo1015/eba9653314997e7bda842e122856c11d to your computer and use it in GitHub Desktop.
Save sinyo1015/eba9653314997e7bda842e122856c11d to your computer and use it in GitHub Desktop.
<?php
$connection = mysqli_connect("localhost", "root", "", "tb_apalah");
//Ambil Status
$user = "1";
$query2 = mysqli_query($connection, "SELECT status FROM tbnya WHERE id_user = '$user'");
$result = mysqli_fetch_row($query2);
//Ambil status
$hasil = $result['status'];
//Update Status
$user = $_POST['user_id'];
$status = $_POST['status'];//Anggap 0 masih dp, 1 masih belum lunas, dan 2 lunas
$sql = mysqli_query($connection, "UPDATE tbnya SET status = '$status' WHERE id_user = '$user'");
@sinyo1015
Copy link
Author

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div>
        <form>
            <div>
                <label>ID User</label>
                <input name="id_user" value="1" readonly />
            </div>
            <div>
                <label>Status</label>
                <select name="status" id="">
                    <option value="0">DP</option>
                    <option value="1">Belum Lunas</option>
                    <option value="2">Lunas</option>
                </select>
            </div>

            <button type="submit">Kirim</button>
        </form>
    </div>
</body>
</html>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment