为什么我的表单值PHP读不出来?(急) 用$index=$_POST['index']; 试试, 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 改下面这个,而不改.PHP文件<input type='checkbox' name='index' value=1>1</td><input type='checkbox' name='index' value=2>2</td><input type='checkbox' name='index' value=3>3</td><input type='checkbox' name='index' value=4>4</td><input type='checkbox' name='index' value=5>5</td> php.ini中error_reporting = E_ALL & ~E_NOTICE或在程序开头加上:error_reporting(E_ALL & ~E_NOTICE); 我是要读出里面的数据,不是不想看见error message。index的值怎么也读不出来 php.ini中error_reporting = E_ALL & ~E_NOTICE还有register_globals = On 程序没有问题,是你的php.ini的问题,我试过了,在我的机子上你的程序没有问题 <?if ($submit) {$total = count($index);echo "The total selected items are : $total<br>";for($i=0;$i<=$total;$i++) echo $index[$i]."<br>";}else{ ?><form method=post><input type='checkbox' name='index[]' value=1>1</td><input type='checkbox' name='index[]' value=2>2</td><input type='checkbox' name='index[]' value=3>3</td><input type='checkbox' name='index[]' value=4>4</td><input type='checkbox' name='index[]' value=5>5</td><input type=submit name=submit></form><? } ?> 出现错误信息“Unable to load dynamic library 'c:/php/extensions/php_oci8.dll'”,其实是一个表面错误,我想你一定没有安装Oracle8i 的客户端。首先,访问http://otn.oracle.com/software/products/oracle8i/index.html下载8.1.7 Client for windows,按照标准方式安装就可以了。然后,检查你的php.ini中"extension_dir = c:\php\extensions"是不是设置正确(请确定'c:/php/extensions/php_oci8.dll'文件存在)。最后,启动Apache成功! <?php// 自 PHP 4.1.0 起可用 print $_POST['username']; print $_REQUEST['username']; import_request_variables('p', 'p_'); print $p_username;// 自 PHP 3 起可用。自 PHP 5.0.0 起,这些较长的预定义变量// 可用 register_long_arrays 指令关闭。 print $HTTP_POST_VARS['username'];// 如果 PHP 指令 register_globals = on 时可用。不过自// PHP 4.2.0 起默认值为 register_globals = off。// 不提倡使用/依赖此种方法。 print $username;?> 变量未定义直接使用$HTTP_POST_VARS['index'] 不明白你的表单是怎么发送过去的,一个提交按钮都没有。然后你把enctype="text/plain"去掉就行了 .html<form action="test3.php" method="POST"> <input type='checkbox' name='index[]' value=1 >1<input type='checkbox' name='index[]' value=2 >2<input type='checkbox' name='index[]' value=3 >3<input type='checkbox' name='index[]' value=4 >4<input type='checkbox' name='index[]' value=5 >5<input type='submit'></form>.php<?php$index=$HTTP_POST_VARS["index"]; print_r ($index);?>全部選中的結果; Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 [4] => 5 ) 問題出在.html中. 是"value=1 >",不是"value=1>",看出來了吧!! pdo bindValue 可不可以用in条件啊 有人熟悉安居客这个网站!我想做一个类似的网站!好做吗! 【求助】用smarty,jquery,php的ajax分页问题。 诚心寻求PHP师父,回报师父提出~~~~ php网站下载文件 php5连接oracle10g 请问php团队开发用什么的管理软件保持同步 我的php登录程序总是写得不好,谁能给我几份例子程序。 使用Header 的问题求教!+ 韩顺平老师 ajax 聊天室 数据出入不进去 请高手帮看看这是怎么回事啊 用passthru执行ssh -l username xxx.xxx.xxx.xxx ls -al得不到输出?
<input type='checkbox' name='index' value=1>1</td>
<input type='checkbox' name='index' value=2>2</td>
<input type='checkbox' name='index' value=3>3</td>
<input type='checkbox' name='index' value=4>4</td>
<input type='checkbox' name='index' value=5>5</td>
或在程序开头加上:
error_reporting(E_ALL & ~E_NOTICE);
还有register_globals = On
if ($submit) {
$total = count($index);
echo "The total selected items are : $total<br>";
for($i=0;$i<=$total;$i++) echo $index[$i]."<br>";
}
else{ ?>
<form method=post>
<input type='checkbox' name='index[]' value=1>1</td>
<input type='checkbox' name='index[]' value=2>2</td>
<input type='checkbox' name='index[]' value=3>3</td>
<input type='checkbox' name='index[]' value=4>4</td>
<input type='checkbox' name='index[]' value=5>5</td>
<input type=submit name=submit>
</form>
<? } ?>
// 自 PHP 4.1.0 起可用 print $_POST['username'];
print $_REQUEST['username']; import_request_variables('p', 'p_');
print $p_username;// 自 PHP 3 起可用。自 PHP 5.0.0 起,这些较长的预定义变量
// 可用 register_long_arrays 指令关闭。 print $HTTP_POST_VARS['username'];// 如果 PHP 指令 register_globals = on 时可用。不过自
// PHP 4.2.0 起默认值为 register_globals = off。
// 不提倡使用/依赖此种方法。 print $username;
?>
直接使用$HTTP_POST_VARS['index']
然后你把enctype="text/plain"去掉就行了
<form action="test3.php" method="POST">
<input type='checkbox' name='index[]' value=1 >1
<input type='checkbox' name='index[]' value=2 >2
<input type='checkbox' name='index[]' value=3 >3
<input type='checkbox' name='index[]' value=4 >4
<input type='checkbox' name='index[]' value=5 >5
<input type='submit'>
</form>.php
<?php
$index=$HTTP_POST_VARS["index"];
print_r ($index);
?>全部選中的結果; Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 [4] => 5 ) 問題出在.html中. 是"value=1 >",不是"value=1>",看出來了吧!!