D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
skdesign
/
public_html
/
admin
/
Filename :
edit_banners.php
back
Copy
<?php include('header.php'); include('menu.php'); include('connect.php'); $id=$_GET['id']; if(isset($_POST['save'])){ extract($_POST); $target_path = "uploads/banners/"; $target_path = $target_path . basename( $_FILES['file']['name']); if(move_uploaded_file($_FILES['file']['tmp_name'], $target_path)) { $a="update banner set title_one='$title_one',title_two='$title_two', banner_picture='$target_path' where banner_id=$id"; $done=mysqli_query($conn,$a); }else{ $a="update banner set title_one='$title_one',title_two='$title_two',banner_url='nill' where banner_id=$id"; // exit; $done=mysqli_query($conn,$a); } } ?> <!-- Content Wrapper. Contains page content --> <div class="content-wrapper"> <!-- Content Header (Page header) --> <section class="content-header"> <div class="container-fluid"> <div class="row mb-2"> <div class="col-sm-6"> <h1>Banners</h1> </div> <div class="col-sm-6"> <ol class="breadcrumb float-sm-right"> <li class="breadcrumb-item"><a href="#">Home</a></li> <li class="breadcrumb-item active">Banners</li> </ol> </div> </div> </div><!-- /.container-fluid --> </section> <!-- Main content --> <section class="content"> <div class="container-fluid"> <div class="row"> <div class="col-6"> <div class="card"> <div class="card-header"> <h3 class="card-title">Display Banners</h3> </div> <!-- /.card-header --> <div class="card-body"> <table id="example1" class="table table-bordered table-striped"> <thead> <tr> <th>Title One</th> <th>Title Two</th> <th>Banners Picture</th> <th>Edit</th> </tr> </thead> <tbody> <?php $done="select * from banner"; $done1=mysqli_query($conn,$done); while($row=mysqli_fetch_array($done1)){ ?> <tr> <td><?php echo $row['title_one'];?></td> <td><?php echo $row['title_two'];?> </td> <td><img src="<?php echo $row['banner_picture'];?>" width="100px" height="100px"></td> <td><a href="edit_banners.php?id=<?php echo $row['banner_id']?>"> <button type="button" class="btn btn-danger">Edit</button> </a></td> </tr> <?php }?> </tfoot> </table> </div> <!-- /.card-body --> </div> <!-- /.card --> </div> <!-- /.col --> <div class="col-6"> <form method="post" action="" enctype="multipart/form-data"> <div class="card"> <div class="card-header"> <h3 class="card-title">Display Banners</h3> </div> <?php $done1="select * from banner where banner_id=$id"; $done11=mysqli_query($conn,$done1); $row2=mysqli_fetch_array($done11); ?> <input type="hidden" value="<?php echo $id;?>" name="id" class="form-control"> <!-- /.card-header --> <div class="card-body"> <table id="example1" class="table table-bordered table-striped"> <thead> <tr> <td>Title One</td><td><input type="text" value="<?php echo $row2['title_one'];?>" name="title_one" class="form-control"></td> </tr> <tr> <td>Title Two</td><td><input type="text" value="<?php echo $row2['title_two'];?>" name="title_two" class="form-control"></td> </tr> <tr> <td>Banners Picture</td><td><input type="file" value="<?php echo $row2['banner_picture'];?>" name="file" class="form-control"></td> </tr> <tr> <td>Banner Picture</td> <td><img src="<?php echo $row2['banner_picture'];?>" width="100px" height="100px"></td></tr> <tr> <td colspan="2" align="center"><input type="submit" name="save" value="Save Record" class="btn btn-success"> <input type="reset" name="reset" value="Clear Record" class="btn btn-danger"></td></tr> </thead> <tbody> </tbody> </table> </form> </div> </div> </div> <!-- /.row --> </div> <!-- /.container-fluid --> </section> <!-- /.content --> </div> <!-- /.content-wrapper --> <?php include('footer.php'); ?>