ok
Direktori : /home2/selectio/www/salemgovtitialumni.in/dashboard/admin/ |
Current File : /home2/selectio/www/salemgovtitialumni.in/dashboard/admin/update-membership.php |
<?php require_once('header.php'); ?> <?php $statement_membership = $pdo->prepare("SELECT * FROM tbl_membership where status = 1"); $statement_membership->execute(); $membership_results = $statement_membership->fetchAll(PDO::FETCH_ASSOC); ?> <?php if(isset($_POST['submit'])) { for($i=0; $i<count($_POST['id']); $i++){ $amount = $_POST['amount'][$i]; $id = $_POST['id'][$i]; $statement = $pdo->prepare("UPDATE tbl_membership SET amount=? WHERE id=?"); $result = $statement->execute(array($amount, $id)); } if($result){ $success_message = 'Slider is added successfully!'; } } ?> <section class="content-header"> <div class="content-header-left"> <h1>Add Slider</h1> </div> <div class="content-header-right"> <a href="slider.php" class="btn btn-primary btn-sm">View All</a> </div> </section> <section class="content"> <div class="row"> <div class="col-md-12"> <?php if($error_message): ?> <div class="callout callout-danger"> <p> <?php echo $error_message; ?> </p> </div> <?php endif; ?> <?php if($success_message): ?> <div class="callout callout-success"> <p><?php echo $success_message; ?></p> </div> <?php endif; ?> <form class="form-horizontal" action="" method="post" enctype="multipart/form-data"> <div class="box box-info"> <div class="box-body"> <?php foreach($membership_results as $member){ ?> <div class="form-group"> <label for="" class="col-sm-2 control-label"><?=$member['name']?></label> <div class="col-sm-6"> <input type="text" autocomplete="off" class="form-control" name="amount[]" value="<?=$member['amount']?>"> <input type="hidden" autocomplete="off" class="form-control" name="id[]" value="<?=$member['id']?>"> </div> </div> <?php } ?> <div class="form-group"> <label for="" class="col-sm-2 control-label"></label> <div class="col-sm-6"> <button type="submit" class="btn btn-success pull-left" name="submit">Submit</button> </div> </div> </div> </div> </form> </div> </div> </section> <?php require_once('footer.php'); ?>