首页 > php代码 > 简单post数据保存代码

简单post数据保存代码

是获取表单的数据再用update更新到mysql教程数据库教程

<?php
if ($_POST) {
    $cid = PostGet('cid', 1);
    $address = PostGet('address', 1);
    $sql = "Update cn_loupan_city set address='$address' where id='$cid'";
    $Db = new Db();
    if ($Db->query($sql)) {
        MessAge('修改成功');
    } else {
        MessAge('操作失败,稍后再试!');
    }
    unset($Db);
}
?>
<table width="64%" border="0" cellpadding="0" cellspacing="0">
<form name="form1" method="post" action="s.php教程">
  <tr>
    <td><input type="hidden" name="cid" value="<?php echo $id
?>">
  <textarea name="address" cols="60" rows="10" id="address">
  <?php echo iconv('GB2312', 'UTF-8', $row['address']); ?></textarea></td>
  </tr>
  <tr>
    <td height="31"><input type="submit" name="Submit" value="保存修改"></td>
  </tr>
  </form>
</table>


文章网址:http://www.phprm.com/code/726702d39605087309832101feaf1216.html

随意转载^^但请附上教程地址。

标签:none

发表留言