作者mrbigmouth (拒绝崩溃的蒲公英)
看板PHP
标题Re: [请益] 如何读取php内物件的名称?
时间Sat Jun 18 07:49:54 2011
产生表单
$result=mysql_query('SELECT * FROM `member_table` ORDER BY `NO` DESC');
$i=0;
while($row = mysql_fetch_array($result))
{
echo '<br />',$row['password'],'
<br />',$row['pic'];
//echo '<img src="123/1.jpg" />';
echo '<br />',$row['NO'],'
<br />',$row['name'],'<input type="checkbox" name="che',$i,'" />
<br />',$row['count'],'<input type="textbox" name="teb',$i,'" />';
++$i;
}
读取$_POST值时
<?php
$che=array();
$teb=array();
$i=0;
while (isset($_POST['che'.$i])){
$che[$i]=$_POST['che'.$i];
++$i;
}
$i=0;
while (isset($_POST['teb'.$i])){
$teb[$i]=$_POST['teb'.$i];
++$i;
}
?>
※ 引述《a3343554 (随风 淡逝)》之铭言:
: 他会照资料库有几笔资料
: 就跑出几个checkbox跟textbox
: 请问要如何抓取textbox的名称?跟之後在网页上所输入的值?
: 就我希望建立出来的textbox
: 可能会叫做textbox1 、 textbox2 ‧‧‧
: 知道名子才能呼叫里头的值不是?
: 我只会用
: "textbox1.value"
: 但不知道textbox的物件名子实在不晓得怎麽呼叫值出来
: 麻烦了>"<
: 因为有点急
: 1000P 奉上。
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 218.170.62.155
※ 编辑: mrbigmouth 来自: 218.170.62.155 (06/18 07:50)
※ 编辑: mrbigmouth 来自: 118.170.215.32 (06/18 12:38)
※ 编辑: mrbigmouth 来自: 118.170.215.32 (06/18 12:50)