我有以下代码:
<form action="" method="POST">
<?php
$count = isset($_POST['count']) ? $_POST['count'] : 1;
if($count > 11) $count = 11;
?>
<table>
<!-- Keeps track of the current number of rows -->
<input type="hidden" name="count" value="<?php echo $count+1; ?>"/>
<?php for($i = 0; $i < $count; $i++):
// Loop through all rows gathering the data here, and then creating the fields below
$val0 = isset($_POST['field'][$i]['0']) ? $_POST['field'][$i]['0'] : '';
$val1 = isset($_POST['field'][$i]['1']) ? $_POST['field'][$i]['1'] : '';
$val2 = isset($_POST['field'][$i]['2']) ? $_POST['field'][$i]['2'] : '';
?>
<tr>
<td><input name="field[<?php echo $i; ?>][0]" value="<?php echo $val0; ?>"/></td>
<td><input name="field[<?php echo $i; ?>][1]" value="<?php echo $val1; ?>"/></td>
<td><input name="field[<?php echo $i; ?>][2]" value="<?php echo $val2; ?>"/></td>
</tr>
<?php endfor; ?>
</table>
<input type="submit" value="click me" />
如何将字段设置为下拉列表,当您按下提交回显的下拉列表作为文本而不是下拉列表?
答案 0 :(得分:0)
首先:填写以下内容:
如果您想要一个下拉菜单,请将<select>
与<option>
...
这是开始学习如何:
http://www.echoecho.com/htmlforms11.htm
要打印结果,请执行以下操作:
if(isset($_POST['send'])
{
print($_POST['youroptionname']);
}
我希望它对你有所帮助。