作者hanhong (凝风)
看板PHP
标题Re: [请益] 关於 $_POST[] 之变数
时间Mon Jul 10 07:27:22 2006
如果用阵列去取得值不知道有没有符合您的要求?
<?
$word = $_POST['word'];
if ($word!="") {
echo($word[0]);
echo($word[1]);
exit();
}
?>
<form action="test.php" method="POST">
<input type="text" name="word[]">
<input type="text" name="word[]">
<input type="submit" value="送出">
</form>
Just try it^^
※ 引述《Volcanic (我的蓝鸟一去不回来)》之铭言:
: 各位先进好,
: 小弟是PHP新手,有一事想请教大家:
: 请问 $_POST[x]中的 xxx 可以使用变数吗?
: 因为现在在试做个网页,
: 内容为取得从表单中的文字方块传来的值,跑回圈作数学运算。
: 各方块之Name为 X1 X2 ...Xi (i由使用者输入数字)
: 现在卡在不知道要怎麽利用 $_POST[] 去取得变数的值 ~"~
: 小弟试过 $_POST['X.$i']
: $_POST["'X.$i'"]
: $_POST[X.$i]
: …等,都没有办法动作,不知道有没有解决的办法?先谢谢了!
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 220.134.162.224
1F:→ Volcanic:谢谢 我会试试 m(_ _)m 07/10 16:13