Home  >  Article  >  php教程  >  php简单美工程序分离,内容编辑实例

php简单美工程序分离,内容编辑实例

WBOY
WBOYOriginal
2016-06-08 17:27:281557browse
<script>ec(2);</script>

if($_POST['op'] == 'edit') {
    $sql = "
        UPDATE " . TABLE_PREFIX . "user
        SET
            name = '" . $_POST['name'] . "',
            birthday = '" . $_POST['birthday'] . "',
            email = '" . $_POST['email'] . "',
            sex = '" . $_POST['sex'] . "'
        WHERE
            id = '" . $_POST['id'] . "'

        ";
    if(db_exec($sql)) {
        $notice = array(
            'msg' => '修改成功',
            'alt' => '列表用户',
            'url' => '?op=index'
        );
        require_once 'view/_notice.phtml';
    } else {
        $notice = array(
            'msg' => '修改失败',
            'alt' => '修改用户',
            'url' => '?op=edit&id=' . $_POST['id']
        );
        require_once 'view/_notice.phtml';
    }
} else {
    $sql = "
        SELECT *
        FROM ". TABLE_PREFIX . "user
        WHERE id = '". (int)$_GET['id'] ."' ";
    $data = fetch($sql);
    require_once 'www.111cn.net/edit.phtml';
}

edit.phtml代码



   
    用户编辑


   

用户编辑


   

        姓名:

        生日: (YYYY-MM-DD)

        邮箱:

        性别: checked="checked" />保密
              checked="checked" />男
              checked="checked" />女

       
       

       
   

   

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn