<script language="javascript" src="js/orderform_functions.js"></script>
<form id="form1" name="form1" method="post" action="">
<table width="500" border="0" align="center" cellpadding="0" cellspacing="0">
<?php
include_once("class/dbconn.class.php");
$dbConn=new dbConn;
$sql="select * from proudct";
$result=$dbConn->connection($sql);
$i=0;
while($arr=mysql_fetch_array($result["rs"])){
if($i%4==0){
?>
<tr>
<?php
}
?>
<td height="151"><table width="125" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="76"><img src="images/2007-5-29-10869-21842347-NK-020.gif" width="164" height="179" /></td>
</tr>
<tr>
<td height="25">市场价:<?=$arr['proudctJiage']?></td>
</tr>
<tr>
<td height="25">会员价:<?=$arr["proudctHuiyuan"]?></td>
</tr>
<tr>
<td height="25"><label>
<input name="spSl[<?=$i;?>]" type="text" id="spSl[<?=$i;?>]" value="1" size="4" />
<input type="button" name="Submit" value="购买" onclick="SetOrderForm('<?=$arr["proudctId"]?>','<?=$arr["proudctName "]?>',document.getElementsByName('spSl[<?=$i;?>]').value,'<?=$arr["proudctHuiyuan"]?>')"/>
<script language="javascript">
alert(document.getElementsByName('spSl[<?=$i;?>].value'));
</script>
<?php echo $i;?></label></td>
</tr>
</table></td>
<?php
$i++;
}
?>
</tr>
</table>
</form>
我要得到每个文本框的值,应该怎么得到啊
<form id="form1" name="form1" method="post" action="">
<table width="500" border="0" align="center" cellpadding="0" cellspacing="0">
<?php
include_once("class/dbconn.class.php");
$dbConn=new dbConn;
$sql="select * from proudct";
$result=$dbConn->connection($sql);
$i=0;
while($arr=mysql_fetch_array($result["rs"])){
if($i%4==0){
?>
<tr>
<?php
}
?>
<td height="151"><table width="125" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="76"><img src="images/2007-5-29-10869-21842347-NK-020.gif" width="164" height="179" /></td>
</tr>
<tr>
<td height="25">市场价:<?=$arr['proudctJiage']?></td>
</tr>
<tr>
<td height="25">会员价:<?=$arr["proudctHuiyuan"]?></td>
</tr>
<tr>
<td height="25"><label>
<input name="spSl[<?=$i;?>]" type="text" id="spSl[<?=$i;?>]" value="1" size="4" />
<input type="button" name="Submit" value="购买" onclick="SetOrderForm('<?=$arr["proudctId"]?>','<?=$arr["proudctName "]?>',document.getElementsByName('spSl[<?=$i;?>]').value,'<?=$arr["proudctHuiyuan"]?>')"/>
<script language="javascript">
alert(document.getElementsByName('spSl[<?=$i;?>].value'));
</script>
<?php echo $i;?></label></td>
</tr>
</table></td>
<?php
$i++;
}
?>
</tr>
</table>
</form>
我要得到每个文本框的值,应该怎么得到啊
-------------------------------------------------------------------
<input name="spSl[<?=$i;?>]" type="text" id="spSl[<?=$i;?>]" value="1" size="4" />
-------------------------------------------------------------------
到你要提交的页用个for循环就能得到每个文本框的值。