有没有PHP的注册页的例子啊。..

解决方案 »

  1.   

    简单的HTML表单提交关键是后面的对数据库的操作,你刚接触的话应该是对这个不太熟悉。第一步:打开数据库链接:$localhost="localhost";
    $user="root";
    $password="123456";
    $db="mydb";
    function db_connect($user,$password,$db){
      mysql_connect($localhost, $user, $password)                //链接函数
           or die('I cannot connect to db: ' . mysql_error());    //链接失败将返回错误信息
      mysql_select_db($db);                                        //选择使用的数据库
    }  db_connect();        //打开数据库第二步:数据库操作:1、插入数据$sql = "insert into users (username, email, password) values ('".$_POST["name"]."', '".$_POST["email"]."', '".$passwords[0]."')";
    $result = mysql_query($sql);    //得到查询结果
    if ($result){
        echo "It's entered!";
    } else {
        echo "There's been a problem: ".mysql_error();
    } 2、查询并显示数据$sqlAll = "select * from users";
    $result = mysql_query($sqlAll);
    $row = mysql_fetch_array($result);        //得到记录集的一行,放到数组row中
    while ($row) {
        echo $row["username"]." -- ".$row["email"]."<br />";
    } 第三步:释放并关闭数据库链接@mysql_free_result($result);mysql_close();//执行完后关闭数据库 
      

  2.   


    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>增加用户</title>
    <style type="text/css">
    <!--
    .STYLE1 {
    color: #FFFFFF;
    font-weight: bold;
    }
    -->
    </style>
    </head>
    <body>
    <?php
    if($_POST['submit'])
    {
    $wyx_name=$_POST['wyx_name'];
    $wyx_pass=md5(trim($_POST['wyx_pass1']));
    $sql="INSERT INTO wyx_user (wyx_name,wyx_pass) VALUES ('$wyx_name','$wyx_pass')";
    $result=mysql_query($sql);
    header("Location:admin_user.php");
    }
    else
    {
    ?>
    <form method="post" name="form1" action="<?php echo $PATH_INFO;?>">
    <table width="400" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#666666">
      <tr>
        <td colspan="2" align="center" bgcolor="#666666" class="STYLE1">增加新用户</td>
      </tr>
        <tr>
        <td width="150" align="right" bgcolor="#FFFFFF">用户名:</td>
        <td width="250" bgcolor="#FFFFFF"><input name="wyx_name" type="text" size="17"/> 
    <font color=red>*</font></td>
        </tr>
      <tr>
        <td width="150" align="right" bgcolor="#FFFFFF">密码:</td>
        <td width="250" bgcolor="#FFFFFF">
    <input name="wyx_pass1" type="password" size="18"/> <font color=red>*</font></td>
      </tr>
      <tr>
        <td width="150" align="right" bgcolor="#FFFFFF">重复密码:</td>
        <td width="250" bgcolor="#FFFFFF">
    <input name="wyx_pass2" type="password" size="18"/> <font color=red>*</font></td>
      </tr>
      <tr>
        <td colspan="2" align="center" bgcolor="#FFFFFF"><input type="submit" name="submit" value="提交" /></td>
      </tr>
    </table>
    </form>
    <?php
    }
    ?>
    </body>这个没有对两次输入的密码进行验证
    连接数据库的代码就不要我写了吧
      

  3.   

    你首先应该学习的是如何使用google