mirror of https://github.com/itflow-org/itflow
Fixed account type not showing by default on edit
This commit is contained in:
parent
9c099f7f98
commit
bb559a4bdb
|
|
@ -10,7 +10,6 @@
|
||||||
<form action="post.php" method="post" autocomplete="off">
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
<input type="hidden" name="account_id" value="<?php echo $account_id; ?>">
|
<input type="hidden" name="account_id" value="<?php echo $account_id; ?>">
|
||||||
<div class="modal-body bg-white">
|
<div class="modal-body bg-white">
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Account Name <strong class="text-danger">*</strong></label>
|
<label>Account Name <strong class="text-danger">*</strong></label>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
|
|
@ -20,7 +19,6 @@
|
||||||
<input type="text" class="form-control" name="name" value="<?php echo $account_name; ?>" placeholder="Account name" required>
|
<input type="text" class="form-control" name="name" value="<?php echo $account_name; ?>" placeholder="Account name" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Account Type <strong class="text-danger">*</strong></label>
|
<label>Account Type <strong class="text-danger">*</strong></label>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
|
|
@ -29,24 +27,27 @@
|
||||||
</div>
|
</div>
|
||||||
<select class="form-control select" name="type" required>
|
<select class="form-control select" name="type" required>
|
||||||
<option value="">- Select -</option>
|
<option value="">- Select -</option>
|
||||||
<!-- If $account_type is set and exists in the array, show it as selected -->
|
<?php
|
||||||
<?php if (isset($account_type) && isset($account_types[$account_type])): ?>
|
$sql_account_type = mysqli_query($mysqli, "SELECT * FROM account_types WHERE account_type_id = $account_type_id");
|
||||||
<option value="<?php echo $account_type; ?>" selected><?php echo $account_types[$account_type]; ?></option>
|
$row = mysqli_fetch_array($sql_account_type);
|
||||||
<?php endif; ?>
|
$account_type_name = nullable_htmlentities($row['account_type_name']);
|
||||||
|
echo "<option value='$account_type_id' selected>$account_type_name</option>";
|
||||||
|
?>
|
||||||
<option value="">----------------</option>
|
<option value="">----------------</option>
|
||||||
<!-- Loop through the associative array to generate the options -->
|
<?php
|
||||||
<?php foreach ($account_types as $value => $label): ?>
|
$sql_account_types = mysqli_query($mysqli, "SELECT * FROM account_types ORDER BY account_type_name ASC");
|
||||||
<option value="<?php echo $value; ?>"><?php echo $label; ?></option>
|
while ($row = mysqli_fetch_array($sql_account_types)) {
|
||||||
<?php endforeach; ?>
|
$account_type_id = intval($row['account_type_id']);
|
||||||
|
$account_type_name = nullable_htmlentities($row['account_type_name']);
|
||||||
|
if($account_type_id % 10 != 0) {
|
||||||
|
echo "<option value='$account_type_id'>$account_type_name</option>";}}?>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Notes</label>
|
<label>Notes</label>
|
||||||
<textarea class="form-control" rows="5" placeholder="Enter some notes" name="notes"><?php echo $account_notes; ?></textarea>
|
<textarea class="form-control" rows="5" placeholder="Enter some notes" name="notes"><?php echo $account_notes; ?></textarea>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer bg-white">
|
<div class="modal-footer bg-white">
|
||||||
<button type="submit" name="edit_account" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Save</button>
|
<button type="submit" name="edit_account" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Save</button>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue