且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将列表框值插入数据库

更新时间:2023-02-10 12:53:16

Ruthi,
插入选定的列表框值到dababase中
这个过程非常简单..如果您有一个列表框,那么:

Rut

This process is quite simple.. If you have a list box as so:

<select name="list[]" id="Select1" size="4" multiple="multiple">
    <option value="1">item 1</option>
    <option value="2">item 2</option>
    <option value="3">item 3</option>
    <option value="4">item 4</option>
</select>



列表框的名称是指定为数组的list [].提交此表单时,您可以遍历列表数组并将数据存储到数据库中,例如:

foreach(



The name of the list box is list[] specified as an array. When you submit this form you can iterate through the list array and store the data into the database such as:

foreach(


_REQUEST [''list''] as
_REQUEST[''list''] as


list){
//存储
list) {
//Store