Viewing File: /home/quiczmwg/bitmaven.org/admin/update_wallet.php
<?php
include_once ("../_db.php");
if (isset($_POST['btnUpdate'])) {
$id = $_POST['wallet_id'];
$wallet_type = $_POST['wallet_type'];
$network = $_POST['network'];
$wallet_address = $_POST['wallet_address'];
$sql = $conn->prepare("UPDATE wallet SET wallet_type=?, network=?, wallet_address=? WHERE id=?");
$sql->bind_param("sssi", $wallet_type, $network, $wallet_address, $id);
if ($sql->execute()) {
header("Location: manage-wallet.php?msg=updated");
} else {
echo "Error updating record: " . $conn->error;
}
}
$row = null;
if (isset($_GET['id'])) {
$id = $_GET['id'];
$sql = $conn->prepare("SELECT * FROM wallet WHERE id=?");
$sql->bind_param("i", $id);
$sql->execute();
$result = $sql->get_result();
if ($result->num_rows > 0) {
$row = $result->fetch_assoc();
} else {
echo "No wallet found with this ID.";
exit();
}
} else {
echo "No ID provided.";
exit();
}
?>
<?php
include 'head.php';
include 'header.php';
?>
<body class="skin-default fixed-layout">
<div id="main-wrapper">
<?php include 'sidebar.php'; ?>
<div class="page-wrapper">
<div class="container-fluid">
<?php include 'nav.php'; ?>
<div class="container">
<div class="text-left my-3">
<h2>Update Wallet</h2>
</div>
<form action="update_wallet.php" method="post">
<input type="hidden" name="wallet_id" value="<?php echo isset($row['id']) ? $row['id'] : ''; ?>">
<div class="form-group">
<label for="wallet_type">Wallet Type</label>
<input name="wallet_type" type="text" class="form-control my-2" placeholder="Enter Wallet Type" value="<?php echo isset($row['wallet_type']) ? htmlspecialchars($row['wallet_type']) : ''; ?>" required>
</div>
<div class="form-group">
<label for="network">Network</label>
<input name="network" type="text" class="form-control my-2" placeholder="Enter Wallet Network" value="<?php echo isset($row['network']) ? htmlspecialchars($row['network']) : ''; ?>" required>
</div>
<div class="form-group">
<label for="wallet_address">Wallet Address</label>
<input name="wallet_address" type="text" class="form-control my-2" placeholder="Enter Wallet Address" value="<?php echo isset($row['wallet_address']) ? htmlspecialchars($row['wallet_address']) : ''; ?>" required>
</div>
<button type="submit" name="btnUpdate" class="btn btn-success">Update</button>
<a href="manage_wallet.php" class="btn btn-danger">Cancel</a>
</form>
</div>
</div>
</div>
</div>
<?php include 'footer.php'; ?>
</body>
</html>
Back to Directory
File Manager
<