ok
Direktori : /home/ngwcolle/www/mis/admin/ |
Current File : /home/ngwcolle/www/mis/admin/update_user.php |
<?php session_start(); error_reporting(1); include('includes/dbconnection.php'); if (isset($_POST['saveupdates'])) { $adminid = $_SESSION['editid2']; $accounthead = $_POST['firstname2'];$bankacc = $_POST['lastname2']; $bankname = $_POST['phone2'];$ifsc = $_POST['email2']; $signatory = $_POST['sign'];$amtbalance = $_POST['amtbal']; $sql4 = "update tblaccount set accounthead=:firstname2,bankacc=:lastname2,bankname=:lastname3,ifsc=:mobilenumber2,signatory=:signatory,amtbalance=:amtbalance where id=:aid"; $query4 = $dbh->prepare($sql4); $query4->bindParam(':firstname2', $accounthead, PDO::PARAM_STR); $query4->bindParam(':lastname2', $bankacc, PDO::PARAM_STR); $query4->bindParam(':lastname3', $bankname, PDO::PARAM_STR); $query4->bindParam(':mobilenumber2', $ifsc, PDO::PARAM_STR); $query4->bindParam(':signatory', $signatory, PDO::PARAM_STR); $query4->bindParam(':amtbalance', $amtbalance, PDO::PARAM_STR); $query4->bindParam(':aid', $adminid, PDO::PARAM_STR); $query4->execute(); if ($query4->execute()) { echo '<script>alert("Account details has been updated")</script>'; echo "<script>window.location.href ='user_register.php'</script>"; } else { echo '<script>alert("update failed! try again later")</script>'; } } ?> <div class="card-body"> <h4 class="card-title">Update Account Form </h4> <form class="forms-sample" method="post" enctype="multipart/form-data" class="form-horizontal"> <?php $eid = $_POST['edit_id']; $sql = "SELECT * from tblaccount where id=:eid"; $query = $dbh->prepare($sql); $query->bindParam(':eid', $eid, PDO::PARAM_STR); $query->execute(); $results = $query->fetchAll(PDO::FETCH_OBJ); $cnt = 1; if ($query->rowCount() > 0) { foreach ($results as $row) { $_SESSION['editid2'] = $row->id; ?> <div class="form-group"> <label for="exampleInputName1">Head of Account Name</label> <input type="text" name="firstname2" class="form-control" id="firstname2" value="<?php echo $row->accounthead; ?>" required> </div> <div class="form-group"> <label for="exampleInputName1">Bank Account Number</label> <input type="text" name="lastname2" class="form-control" id="lastname2" value="<?php echo $row->bankacc; ?>" required> </div> <div class="form-group"> <label for="exampleInputName1">Bank Name</label> <input type="text" name="phone2" class="form-control" id="phone2" value="0<?php echo $row->bankname; ?>" required> </div> <div class="form-group"> <label for="exampleInputName1">IFSC Code</label> <input type="text" name="email2" class="form-control" value="<?php echo $row->ifsc; ?>" required> </div> <div class="form-group"> <label for="exampleInputName1">Signatory</label> <input type="text" name="sign" class="form-control" value="<?php echo $row->signatory; ?>" required> </div> <div class="form-group"> <label for="exampleInputName1">Opening Balance/Balance Till Date</label> <input type="text" name="amtbal" class="form-control" value="<?php echo $row->amtbalance; ?>" required> </div> <?php } } ?> <button type="submit" name="saveupdates" class="btn btn-primary btn-fw mr-2">Update</button> <button type="button" class="btn btn-success" data-dismiss="modal">Cancel</button> </form> </div>