dbm数据库详解(3)

dbm数据库详解(3)

插入dbm数据库
<?php
if(isset($_POST['Submit']))
{
$name = $_POST['name'];
$telno = $_POST['telno'];
$id = $_POST['id'];

$str = $name.'|#|'.$telno;
$db = dbmopen('db/mydb.db','w');
dbminsert($db,$id,$str);
dbmclose($db);
echo '插入成功!';
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>

<body>

  <table width="42%" border="1" align="center">
  <form name="form1" method="post" action="">
    <tr>
      <td>名字:</td>
      <td><input name="name" type="text" id="name"></td>
    </tr>
    <tr>
      <td>电话:</td>
      <td><input name="telno" type="text" id="telno"></td>
    </tr>
    <tr>
      <td>id:</td>
      <td><input name="id" type="text" id="id"></td>
    </tr>
    <tr>
      <td colspan="2"><div align="center">
        <input type="submit" name="Submit" value="提交">
          
          <input type="reset" name="Submit2" value="重置">
      </div></td>
    </tr></form>
</table>

</body>
</html>

学习中