<?php
include("protect.php");
include("dbconnect.php");
extract($_POST);
$rdate=date("d-m-Y");
$qry=mysql_query("select * from admin where username='admin'");
$row=mysql_fetch_array($qry);
if(isset($btn))
{

mysql_query("update admin set amount=amount+$amount where username='admin'");
	?>
	<script language="javascript">
	alert("Updated Successfully");
	window.location.href="admin.php";
	</script>
	<?php
		
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><?php include("title.php"); ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link href="style.css" rel="stylesheet" type="text/css" />
 <script language="javascript">
            function validate()
            {
			  
                if (document.form1.amount.value == "")
                {
                    alert("Enter the Amount");
                    document.form1.amount.focus();
                    return false;
                }
				
               
                return true;
            }
        </script>
<!-- CuFon ends -->
</head>
<body>

        <form id="form1" name="form1" method="post" action="">
		
		<div class="sd"><!--<a href="index.php">Home</a>-->
    <?php include("link_admin.php"); ?>
  </div>
		
          <h2 align="center">ATM - Amount Details  </h2>
          <table width="342" height="197" border="0" align="center" class="bg1">
            <tr>
              <th align="left" scope="col">Available Amount </th>
              <th align="left" scope="col">Rs. <?php echo $row['amount']; ?></th>
            </tr>
            <tr>
              <th align="left" scope="col">ATM Amount </th>
              <th align="left" scope="col"><input type="text" name="amount" /></th>
            </tr>
            <tr>
              <th colspan="2" scope="row"><input type="submit" name="btn" value="Submit" onClick="return validate()" /></th>
            </tr>
          </table>
          <h2 align="center" class="msg"><?php 
		  if($row['amount']<=1000)
		  {
		  echo "Amount is below Rs.1000 , Cash required in ATM!!!";
		  
		  }
		  
		   ?></h2>
		  <p>&nbsp;</p>
		  <p>&nbsp;</p>
  <p align="center" class="sd"><?php include("title.php"); ?></p>
        </form>
      
       

</body>
</html>