<?php require('includes/head.php');
require 'connection/conn.php';
 if(isset($_POST['submit']))
 {
     $c=$_POST['customer_id'];
	 $n=$_POST['name'];
	 $m=$_POST['mobile'];
	 $a=$_POST['address'];
	  $l=$_POST['limit'];
	  $cur=$_POST['cur'];
	 $add="update  `customer`    set `currency`='$cur',`limit`='$l',`customer_name`='$n', `user`='$user',`customer_mobile`='$m' , `customer_address`='$a' where `customer_id`='$c'";
	$conn->query($add);
	echo "<script type='text/javascript'>
		           window.location.href='customer_list.php'
		        </script>";
 }
 
 $id=$_GET['id'];
 $check="SELECT * FROM `customer` WHERE `customer_id`='$id'";
	$check_r=$conn->query($check);
	$row=mysqli_fetch_array($check_r);
?>


<div class="container">
          <div class="page-inner">
            <div class="page-header">
              <h3 class="fw-bold mb-3">گۆڕانکاری</h3>
              <ul class="breadcrumbs mb-3">
                <li class="nav-home">
                  <a href="home.php">
                    <i class="icon-home"></i>
                  </a>
                </li>
                <li class="separator">
                  <i class="icon-arrow-right"></i>
                </li>
                <li class="nav-item">
                  <a href="#"></a>
                </li>
                <li class="separator">
                  <i class="icon-arrow-right"></i>
                </li>
                <li class="nav-item">
                  <a href="#"></a>
                </li>
              </ul>
            </div>
            <div class="row">
              <div class="col-md-12">
                <div class="card">
                  
                  <div class="card-body">
                    <div class="table-responsive">
                      <table
                        id="basic-datatables"
                        class="display table table-striped table-hover"
                      >
<form action="" method="post">

<input type="hidden" name="customer_id" value="<?php echo $id;?>"></tr>
	
	
	<tr >
		<td>ناو</td><td><input type="text" name="name" required value="<?php echo $row['customer_name'];?>"></td>
	</tr>
	
	<tr >
		<td>مۆبایل</td><td><input type="number" name="mobile" required value="<?php echo $row['customer_mobile'];?>"></td>
	</tr>
	<tr >
		<td>ناونیشان</td><td><input type="text" name="address" required value="<?php echo $row['customer_address'];?>"></td>
	</tr>
	<tr >
		<td>ماوە</td><td><input type="number" name="limit" required value="<?php echo $row['limit'];?>"></td>
	</tr>
	<tr >
		<td>عملة</td><td>
						<select name="cur" required>
						<?php 
						$cur= $row['currency'];
						if($cur=="$"){
						?>
							<option value="$">$</option>
							<option value="IQD">IQD</option>
						<?php } else{ ?>
							<option value="IQD">IQD</option>
							<option value="$">$</option>
						<?php } ?>
						</select>
					</td>
	</tr>
	<tr >
		<td></td><td><input type="submit" name="submit" value="گۆڕین"></td>
	</tr>
  </table>
 
</form>

</div>
                  </div>
                </div>
              </div>
			  
			  </div>
          </div>
        </div>
<?php require'includes/foot.php';?>