Hacked By AnonymousFox

Current Path : /home/krishnamexports/public_html/panel/fckeditor/
Upload File :
Current File : /home/krishnamexports/public_html/panel/fckeditor/pincode.php

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

		  <?php 

		  

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

			  {

			 		 $pincode    		= $_POST['pincode'];

			  	 	 $state_id			= $_POST['state_id'];

				     $city_id			= $_POST['city_id'];

				  

				  $sqlSubject=mysqli_query ($cn, "insert into `tbl_pincode` set pincode='$pincode',state_id='$state_id',city_id='$city_id'");

				  

				  if ($sqlSubject){

				  echo '<div class="alert alert-success"><strong>Success!</strong> City Page Added Successfully.</div>';

				  }

				  else

				  {

					echo '<div class="alert alert-danger"><strong>Danger!</strong> City Page Not Exist.</div>';

				  }

			  }

		  

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

			{

				$id  			    = $_POST['id'];

				$pincode    		= $_POST['pincode'];

			    $state_id			= $_POST['state_id'];

			    $city_id			= $_POST['city_id'];

				

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

				$sqlData = mysqli_fetch_array($sql);

				

				

				$sqlSubject = mysqli_query ($cn,"update tbl_pincode SET pincode='$pincode',state_id='$state_id',city_id='$city_id' where `id`='$id'");

				if($sqlSubject)

				{

					echo '<div class="alert alert-success"><strong>Success!</strong> City  Page 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_pincode where id='$id'");

			    $sqlData = mysqli_fetch_array ($sql); 

			}

			

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

					{

						$id      = $_GET['delete_id'];

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

						if($sql)

						{

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

						}

						else

						{

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

						}

					}

			?>	

			

			

	</div>

    

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

		<div class="card">

                <div class="card-body">

				  <h4 style="margin-bottom:25px;">Add Pincode</h4>

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

                

                <div class="row">

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

							<div class="form-group">

							  <label for="exampleInputPassword4">Pincode</label>

							  <input type="text" class="form-control" name="pincode" value="<?php if(isset($_GET['edit_id'])) {echo $sqlData['pincode'];}?>" Placeholder="Pincode">

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

							</div>

						</div>

                      

                     

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

						<div class="form-group">

							<label for="exampleInputPassword4">State Page</label>

							<select class="form-control" id="exampleFormControlSelect1" name="state_id" required>

								<option value="">Select State</option>

								<?php

                                    $sqlState = mysqli_query($cn, "select * from `tbl_state`");

                                    while($sqlStateData = mysqli_fetch_array($sqlState)){?>

                                    <option value="<?php echo $sqlStateData['id'];?>" <?php if(isset($_GET['edit_id'])){ if($sqlData['state_id']==$sqlStateData['id']){ echo "selected";}}?>><?php echo $sqlStateData['name'];?></option>

                                    <?php }?>						 

							</select>

						</div>

						</div>

                        

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

						<div class="form-group">

							<label for="exampleInputPassword4">City Page</label>

							<select class="form-control" id="exampleFormControlSelect1" name="city_id" required>

								<option value="">Select City</option>

								<?php

                                    $sqlCity = mysqli_query($cn, "select * from `tbl_city`");

                                    while($sqlCityData = mysqli_fetch_array($sqlCity)){?>

                                    <option value="<?php echo $sqlCityData['id'];?>" <?php if(isset($_GET['edit_id'])){ if($sqlData['city_id']==$sqlCityData['id']){ echo "selected";}}?>><?php echo $sqlCityData['name'];?></option>

                                    <?php }?>						 

							</select>

						</div>

						</div>

                    

                        

						

                    </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>

		</div>

        

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

    <div class="card">

                <div class="card-body">

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

			

                  <div class="table-responsive">

                    <table class="table table-striped">

                      <thead>

                        <tr>

                          <th>Sr. No.</th>

                          <th>Pincode</th>

                          <th>State Page Name</th>

                          <th>City Name</th>

						  <th>Action</th>

                        </tr>

                      </thead>

                      <tbody>

                      	 <?php

						$i = 1;						  

						$sqlPincode = mysqli_query($cn, "select * from `tbl_pincode`");

						  while($sqlPincodeData = mysqli_fetch_array($sqlPincode)){

							  $sqlState = mysqli_query($cn, "select * from `tbl_state` where id='".$sqlPincodeData['state_id']."'");

							  $sqlStateData = mysqli_fetch_array($sqlState);

							  

							  $sqlCity = mysqli_query($cn, "select * from `tbl_city` where id='".$sqlPincodeData['city_id']."'");

							  $sqlCityData = mysqli_fetch_array($sqlCity);

							 ?>

							<tr>

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

                              <td><?php echo $sqlPincodeData['pincode'];?></td>

                              <td><?php echo $sqlStateData['name'];?></td>

                              <td><?php echo $sqlCityData['name'];?></td>

							  <td><a href="home.php?pages=pincode&edit_id=<?php echo $sqlPincodeData['id'];?>">Edit</a> | <a href="home.php?pages=pincode&delete_id=<?php echo $sqlPincodeData['id'];?>" onclick="return deleteConfirm();">Delete</a></td>

							</tr>

                            <?php } ?>

                      </tbody>

                    </table>

                  </div>

                </div>

              </div>

			</div>





            

Hacked By AnonymousFox1.0, Coded By AnonymousFox