Home > php教程 > PHP源码 > body text

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

WBOY
Release: 2016-06-08 17:27:28
Original
1562 people have browsed it
<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" />女

       
       

       
   

   

Related labels:
source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!