File "icon.php"

Full Path: /home/krishnamexports/public_html/panel/pages/currency/icon.php
File size: 7.06 KB
MIME-type: text/x-php; charset=us-ascii
Charset: utf-8

<?php 		  		  

if(isset($_POST['edit']))

{

	$id  			    = $_POST['id'];

	$facebook    		= $_POST['facebook'];

	$twitter	        = $_POST['twitter'];

	$linkeden	      	= $_POST['linkeden'];

	$instagram	      	= $_POST['instagram'];

	$pinterest          = $_POST['pinterest'];

	$youtube    	    = $_POST['youtube'];

		

	$sqlSubject = mysqli_query ($cn,"update tbl_icon SET facebook='$facebook',twitter='$twitter',linkeden='$linkeden', instagram='$instagram', pinterest='".$pinterest."', youtube='$youtube' where `id`=1");

	if($sqlSubject)

	{

		echo '<div class="alert alert-success"><strong>Success!</strong> Icon Link Update Successfully.</div>';

	}

	else

	{

		echo '<div class="alert alert-success"><strong>Warrning!</strong> Not Updated try again.</div>';	

	}

	

}



if(isset($_GET['edit_id']))

{

	$id      = $_GET['edit_id'];

	$sql     = mysqli_query($cn, "select * from tbl_icon where id='$id'");

	$sqlData = mysqli_fetch_array ($sql); 

}

?>	

<?php

if(isset($_GET['edit_id'])){?>    

    <div class="card">

                <div class="card-body">

              

                  <h4 class="card-title">Social Links</h4>

                   

                  <form class="forms-sample" method="post" enctype="multipart/form-data">

                    

						<div class="row">

                        

                        	<div class="col-md-3">

							<div class="form-group">

							  <label for="exampleInputName1">Facebook</label>

							  <input type="hidden" value="<?php if(isset($_GET['edit_id'])) {echo $sqlData['id'];}?>" name="id">

							  <input type="text" class="form-control" value="<?php if(isset($_GET['edit_id'])) {echo $sqlData['facebook'];}?>" name="facebook" id="exampleInputName1" placeholder="Facebook" autocomplete="off">

							</div>

                            </div>

                            

                            

                            

                            <div class="col-md-3">

							<div class="form-group">

							  <label for="exampleInputName1">Twitter</label>

							  <input type="text" class="form-control" value="<?php if(isset($_GET['edit_id'])) {echo $sqlData['twitter'];}?>" name="twitter" id="exampleInputName1" placeholder="Twitter" autocomplete="off">

							</div>

                            </div>

                            

                            <div class="col-md-3">

                                <div class="form-group">

                                  <label for="exampleInputName1">Linkedin</label>

                                  <input type="text" class="form-control" value="<?php if(isset($_GET['edit_id'])) {echo $sqlData['linkeden'];}?>" name="linkeden" id="exampleInputName1" placeholder="Google Plus" autocomplete="off">

                                </div>

                            </div>

                            

                            <div class="col-md-3">

                                <div class="form-group">

                                  <label for="exampleInputName1">Instagram</label>

                                  <input type="text" class="form-control" value="<?php if(isset($_GET['edit_id'])) {echo $sqlData['instagram'];}?>" name="instagram" id="exampleInputName1" placeholder="Google Plus" autocomplete="off">

                                </div>

                            </div>

                            

                            <div class="col-md-3">

                                <div class="form-group">

                                  <label for="exampleInputName1">Pinterest</label>

                                  <input type="text" class="form-control" value="<?php if(isset($_GET['edit_id'])) {echo $sqlData['pinterest'];}?>" name="pinterest" id="exampleInputName1" placeholder="Pinterest" autocomplete="off">

                                </div>

                            </div>

                            

                            <div class="col-md-3">

							<div class="form-group">

							  <label for="exampleInputName1">YouTube</label>

							  <input type="text" class="form-control" value="<?php if(isset($_GET['edit_id'])) {echo $sqlData['youtube'];}?>" name="youtube" id="exampleInputName1" placeholder="YouTube" autocomplete="off" >

							</div>

                            </div>

						</div>	

                        

                        <div class="row">

                        	

                        </div>				

                    

                    <button type="submit" class="btn btn-success mr-2" name="<?php if(isset($_GET['edit_id'])) {echo "edit";}else{ echo "add";}?>">Submit</button>

                    

                  </form>

                </div>

              </div>					

	<br><br>

<?php }?>            

<?php

if(isset($_GET['delete_id']))

{

	$id      = $_GET['delete_id'];

	$sql     = mysqli_query($cn, "delete from tbl_icon where id='$id'");

	if($sql)

	{

		echo '<div class="alert alert-success"><strong>Success!</strong> Icon Link Page Deleted Successfully.</div>';

	}

	else

	{

		echo "error: " . $sql . "<br>" . mysqli_error($conn);	

	}

}

?>

            

 <div class="col-lg-12 grid-margin stretch-card">



              <div class="card">

                <div class="card-body">

                  <h4 class="card-title">Icon List</h4>

			

                  <div class="table-responsive">

                    <table class="table table-striped">

                      <thead>

                        <tr>

                          <th>Sr. No.</th>

						  <th>Facebook</th>

                          <th>Twitter</th>

                          <th>Instagram</th>

                          <th>Linkedin</th>

                          <th>Pinterest</th>

                          <th>YouTube</th>

						  <th>Action</th>

                        </tr>

                      </thead>

                      <tbody>

                      	<?php

						$i = 1;						  

						$sqlEmployee = mysqli_query($cn, "select * from `tbl_icon`");

						  while($sqlEmployeeData = mysqli_fetch_array($sqlEmployee)){

							  

							 ?>

                       		<tr>

							  <td><?php echo $i++;?></td>

                              <td><?php echo $sqlEmployeeData['facebook'];?></td>

                              <td><?php echo $sqlEmployeeData['twitter'];?></td>

                              <td><?php echo $sqlEmployeeData['instagram'];?></td>

                              <td><?php echo $sqlEmployeeData['linkeden'];?></td>

                              <td><?php echo $sqlEmployeeData['pinterest'];?></td>

                              <td><?php echo $sqlEmployeeData['youtube'];?></td>

							  <td><a href="home.php?pages=icon&edit_id=<?php echo $sqlEmployeeData['id'];?>">Edit</a></td>

							</tr>

						  <?php } ?>

								  

                      </tbody>

                    </table>

                  </div>

                </div>

              </div>

            </div>