mirror of https://github.com/itflow-org/itflow
added edit account
This commit is contained in:
parent
adf0104b91
commit
64cbe6a016
|
|
@ -0,0 +1,30 @@
|
|||
<div class="modal fade" id="editAccountModal<?php echo $account_id; ?>" tabindex="-1">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="fa fa-piggy-bank"></i> Modify Account</h5>
|
||||
<button type="button" class="close" data-dismiss="modal">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="account_id" value="<?php echo $account_id; ?>">
|
||||
<div class="modal-body">
|
||||
<div class="form-group">
|
||||
<label>Account Name</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-university"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="name" value="<?php echo $account_name; ?>" placeholder="Account name" required>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
|
||||
<button type="submit" name="edit_account" class="btn btn-primary">Save</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
13
post.php
13
post.php
|
|
@ -134,6 +134,19 @@ if(isset($_POST['add_account'])){
|
|||
|
||||
}
|
||||
|
||||
if(isset($_POST['edit_account'])){
|
||||
|
||||
$account_id = intval($_POST['account_id']);
|
||||
$name = strip_tags(mysqli_real_escape_string($mysqli,$_POST['name']));
|
||||
|
||||
mysqli_query($mysqli,"UPDATE accounts SET account_name = '$name' WHERE account_id = $account_id");
|
||||
|
||||
$_SESSION['alert_message'] = "Account modified";
|
||||
|
||||
header("Location: accounts.php");
|
||||
|
||||
}
|
||||
|
||||
if(isset($_POST['add_category'])){
|
||||
|
||||
$name = strip_tags(mysqli_real_escape_string($mysqli,$_POST['name']));
|
||||
|
|
|
|||
Loading…
Reference in New Issue