Powered By Blogger

Wednesday, February 5, 2014

update form in php using mysql

<?php
include('include/header.php');
?>
<?php

$query = mysql_query("SELECT `name`, `api`, `secret`, `mode`, `pase` FROM `payment_admin`");
$row = mysql_fetch_array($query);
?>

<div class="cont-pay">
    <div id="categroy">
        <div id="add_categroytitle">
          <a>Payment</a>
        </div>
        <form action="" method="post">
      <table width="800" border="0" cellpadding="10">
          <tr>
            <td></td>
            <td></td>
            <td></td>
          </tr>    
          <tr>
            <td>Name</td>
            <td></td>
            <td><input id="pro_name" value="<?php echo $row['name']; ?>" name="name"  /></td>
          </tr>
          <tr>
            <td>Secret Key </td>
            <td></td>
            <td><input id="pro_name" name="secret"  value="<?php echo $row['secret']; ?>" /></td>
          </tr>
          <tr>
            <td>Merchant Identifier(API key)</td>
            <td></td>
            <td><input id="pro_name" name="api"  value="<?php echo $row['api']; ?>"/></td>
          </tr>
          <tr>
            <td>Mode</td>
            <td></td>
            <td><input  id="pro_name" name="mode"  value="<?php echo $row['mode']; ?>" /></td>
          </tr>
          <tr>
            <td>Return Pase</td>
            <td></td>
            <td><input id="pro_name" name="pase"   value="<?php echo $row['pase']; ?>"/></td>
          </tr>
          <tr>
            <td></td>
            <td></td>
            <td></td>
          </tr>
      </table>
      <input id="reg_but" type="submit" />
      </form>
    </div>
</div>


<?php
if(isset($_POST['name']) && isset($_POST['secret']) && isset($_POST['api']) && isset($_POST['mode']) ){

$name =$_POST['name'];
$secret = $_POST['secret'];
$api = $_POST['api'];
$mode = $_POST['mode'];
$pase = $_POST['pase'];

mysql_query("UPDATE `payment_admin` SET
`name`='$name',`api`='$api',`secret`='$secret',`mode`='$mode',`pase`='$pase' ");
header("Location:payment_admin.php");
}
?>

No comments:

Post a Comment