是不是如果选中该checkbox,$_POST['select[1]']就会等于1呢;-------------------------------------------------yes
解决方案 »
- 问个字段分割的问题 希望得到帮助 本人菜鸟 .
- 求意见指导!
- 请问怎么用正则式将一个字符串里的匹配的内容取出来?
- sql查询结果少了一条记录
- 求PHP实现的资源管理器的树形导航菜单代码?!
- 初学动态网页,用php怎么实现网站的下载功能?
- 有没有好用的、PHP的目录遍历程序?
- 以下是我写的PHP表单值提取文件,请高手看一下,哪有问题~[在线等]
- ob_start ob_end_clean()、ob_get_contents()是线程安全的吗
- 可变变量的一个问题
- 小弟有一疑问: 如果一个服务器相当厉害,PHP能把这个服务器的性能发挥出来么。还是只能利用百分之几?
- 请教:我在php中写的这个正则表达式怎么都不对,麻烦大哥帮忙看一下,谢谢了。
<?
for($i=1;$i<10;$i++)
{
?>
<td width="100%" ><input type="checkbox" name="select[<?echo $i?>]" value="<?echo $i?>" ></input></td>
<?
}
?>
</form>
我这样写行吗??
这样该怎么取value的值呢??
{
$name = 'select['.$i.']';
if($_POST[$name])
{
$j++;
$taskId[$j]=$_POST[$name];
}
}
我这样怎么都取不到$_POST[$name]的值。
是不是我哪里写错了。
请各位朋友帮帮我。:(
Array
(
[select] => Array
(
[1] => 1
[3] => 3
[5] => 5
[7] => 7
[9] => 9
))
这个你可以通过print_r($_POST)看到,而不是所希望的
Array
(
[select[1]] => 1
[select[3]] => 3
[select[5]] => 5
[select[7]] => 7
[select[9]] => 9
)因此你需要改变一下你的表单的命名方式。
至于为什么出现这个我就不知道了,还希望知道原因的大虾能指点一下。
<?
for($i=1;$i<10;$i++)
{
?>
<td width="100%" ><input type="checkbox" name="select[]" value="<?echo $i;?>" ></input></td>
<?
}
?>
</form>
and use $_POST['select'][$i] to get the data.($i>=0)
<?
for($i=1;$i<10;$i++)
{
?>
<td width="100%" ><input type="checkbox" name="select[]" value="<?echo $i;?>" ></input></td>
<?
}
?>
</form>
for($i=1;$i<10;$i++)
{
if( $_POST['select'][$i])
{
$j++;
$taskId[$j]=$_POST['select'][$i]);
}
}
现在我已经改成这样了,
可是if语句还是进不去,取得的$_POST['select'][$i的值还是为空。
<form enctype='multipart/form-data' action="" method="POST" name="submit" >
<?
for($i=1;$i<10;$i++)
{
?>
<tr><td width="100%" ><input type="checkbox" name="select[]" value="<?echo $i;?>" ></input><?echo $i;?></td></tr>
<?
}
?>
<tr><td width="100%" ><input type="submit" name="sub" value="submit" ></input></td></tr>
</form>
</table>
<?
print_r($_POST);
$j=0; //初始化赋值
for($i=0;$i<10;$i++) //$i=1 改为 $i=0
{
if( $_POST['select'][$i] )
{
$j++;
$taskId[$j]=$_POST['select'][$i]; //此处多 “)”
}
}
print_r($taskId);
?>
if( $_POST['select'][$i] )
改为
if( is_numeric($_POST['select'][$i]) )
echo "<script LANGUAGE=JavaScript>window.confirm('$String');</script>";
这个window.confirm()怎么知道 用户取的是yes or no呢??
echo "<script LANGUAGE=JavaScript>window.confirm('$String');</script>";
这个window.confirm()怎么知道 用户取的是yes or no呢??
------------------------------------------------------------------------------*** 这个问题GOOGLE或MSDN都能解决 ***confirm Method--------------------------------------------------------------------------------Displays a confirmation dialog box that contains an optional message as well as OK and Cancel buttons.SyntaxbConfirmed = window.confirm( [sMessage])
ParameterssMessage Optional. String that specifies the message to display in the confirmation dialog box. If no value is provided, the dialog box does not contain a message. Return ValueBoolean. Returns one of the following possible values:true The user clicked the OK button.
false The user clicked Cancel button. ResThe title bar of the confirmation dialog box cannot be changed.Standards InformationThere is no public standard that applies to this method.