Php 如何将此Html表单更改为Yii框架

Php 如何将此Html表单更改为Yii框架,php,html,mysql,yii,Php,Html,Mysql,Yii,我在尝试将此html表单更改为Yii框架时遇到一些问题。 在my home.html中: <!doctype html> <head> <meta charset="utf-8"/> <title>Demo Active Table</title> <script type="text/javascript" src="js/jquery-1.9.1.js"></script>

我在尝试将此html表单更改为Yii框架时遇到一些问题。 在my home.html中:

   <!doctype html>

<head>
    <meta charset="utf-8"/>
    <title>Demo Active Table</title>


    <script type="text/javascript" src="js/jquery-1.9.1.js"></script>
    <script type="text/javascript" src="js/jquery-1.9.1.min.js"></script>
    <script type="text/javascript" src="js/home.js"></script>
</head>
<body>
    <div class="layout">
        <header>
            <h2>Edit</h2>
        </header>
        <div class="table">

            <fieldset>
                <table class="table_content" id="table_content">
                    <tbody>
                    <tr>
                        <td class="cell1" ><input type="text" value="0"></td>
                        <td class="cell2" ><input type="text"></td>
                        <td class="cell3" ><input type="text"></td>

                    </tr>
                        <tr>
                            <td class="cell1" ><input type="text" value="1"></td>
                            <td class="cell2" ><input type="text"></td>
                            <td class="cell3" ><input type="text"></td>
                            <td class="cell4" ><input type="button" value="Delete" class="button" id="delete"></td>
                        </tr>
                    </tbody>
                </table>
            </fieldset>

            <div class="footer">
                <input type="button" value="Add" class="button w128" id="add">
                <input type="button" value="Sort" class="button w128" id="sort">
            </div>
        </div>
        <footer>
            <input type="button" value="Save" class="button w128" id="add">
        </footer>
    </div>
</body>
</html>

演示活动表
编辑
在我的家里

    var index = 1;
$(document).ready(function() {
    $('#add').on('click',addRow);
    $('fieldset input[type="button"]').on('click',delRow);
});

function addRow(){
    //prevent add more row
    if(count('tr')==11){
        return false;
    }
    //set index
    setIndex();
    //add row
    var html = '<tr>';
        html +='<td class="cell1" ><input type="text" value="'+index+'"></td>';
        html +='<td class="cell2" ><input type="text"></td>';
        html +='<td class="cell3" ><input type="text"></td>';
        html +='<td class="cell4" ><input type="button" value="Delete" class="button" id="delete"></td>';
        html +='</tr>';
    $('#table_content tbody').append(html);
    //ini onclick for new delete button
    $('fieldset input[type="button"]').on('click',delRow);
}

function delRow(){ 
    var parent = $(this).parent().parent();
    parent.remove();
};

function count(tab){
    var count = 0;
    $(tab).each(function(){
        count++;
    });
    return count;
}

function setIndex(){
    var lastIndex = parseInt($("tr:last").find('input').val());
    index = lastIndex +1;
}
var指数=1;
$(文档).ready(函数(){
$('添加')。在('单击',添加行)上;
$('fieldset input[type=“button”]”)。在('click',delRow');
});
函数addRow(){
//防止添加更多行
如果(计数('tr')==11){
返回false;
}
//集合索引
setIndex();
//添加行
var html='';
html+='';
html+='';
html+=“”;
html+='';
html+='';
$('#table_content tbody')。附加(html);
//ini onclick用于新建删除按钮
$('fieldset input[type=“button”]”)。在('click',delRow');
}
函数delRow(){
var parent=$(this.parent().parent();
parent.remove();
};
函数计数(选项卡){
var计数=0;
$(选项卡)。每个(函数(){
计数++;
});
返回计数;
}
函数setIndex(){
var lastIndex=parseInt($(“tr:last”).find('input').val();
指数=最后指数+1;
}
假设我的数据库中有一个包含4列的表:

  • ID int(主键自动递增)
  • text1 varchar
  • text2varchar
  • 优先整数
“Previor”是指当我单击按钮“add”时,它在第一列中自动增加。 “排序”按钮是在我单击“排序”时出现的:表单是按“优先”ASC自动排序的 “保存”按钮是指当我单击“保存”时,所有行都将保存到数据库中。 有人能帮我吗,
非常感谢。

你没有要求别人为你编写代码,这就是为什么。但老实说,至少试一下,把你的错误发回给他们,他们发明文档是有原因的。