php页面中
<form>表单下有 checkbox标签,如 <form method="post" name="addform" action="/secondHouse/rank_add_act.php">
<input name="price[]" type="checkbox" checked="checked" style="margin-bottom:-1px;" value="1"> 20-30万
<input name="price[]" type="checkbox" style="margin-bottom:-1px;" value="2"> 30-40万
</form>现需:1 checkbox标签只可显示,不可操作
2 提交表单时,要得到checkbox的值,
这如何实现呀,thanks
<form>表单下有 checkbox标签,如 <form method="post" name="addform" action="/secondHouse/rank_add_act.php">
<input name="price[]" type="checkbox" checked="checked" style="margin-bottom:-1px;" value="1"> 20-30万
<input name="price[]" type="checkbox" style="margin-bottom:-1px;" value="2"> 30-40万
</form>现需:1 checkbox标签只可显示,不可操作
2 提交表单时,要得到checkbox的值,
这如何实现呀,thanks
<input name="price[]" type="checkbox" checked="checked" style="margin-bottom:-1px;" value="1" disabled="disabled"> 20-30万
<input name="price[]" type="checkbox" style="margin-bottom:-1px;" value="2" disabled="disabled"> 30-40万
</form>
<input name="price[]" type="checkbox" checked="checked" style="margin-bottom:-1px;" value="1" onclick="return false;"> 20-30万
<input name="price[]" type="checkbox" style="margin-bottom:-1px;" value="2" onclick="return false;"> 30-40万
</form>
<?php
foreach($_POST['price'] as $key=>$value)
{
switch ($value)
{
case 1:
echo '20-30万<br/>';
break;
case 2:
echo '30-40万<br/>';
break;
}
};
?>
<input name="price[]" type="checkbox" checked="checked" style="margin-bottom:-1px;" value="1" readonly="true"> 20-30万
<input name="price[]" type="checkbox" style="margin-bottom:-1px;" value="2" readonly="true"> 30-40万
<input type="submit" name="Submit" value="提交" />
</form>
<input name="price[]" type="checkbox" checked="checked" style="margin-bottom:-1px;" value="1" disabled="disabled" > 20-30万
<input name="price[]" type="checkbox" style="margin-bottom:-1px;" value="2" disabled="disabled"> 30-40万
<input type="submit" name="Submit" value="提交" />
</form>
if ($_POST['submit'])
{
$price = $_POST['price'];
print_r($price);
}
?>
<form method="post" name="addform" action="">
<input name="price[]" type="checkbox" checked="checked" style="margin-bottom:-1px;" value="1">20-30万
<input name="price[]" type="checkbox" style="margin-bottom:-1px;" value="2" >30-40万
<input name="submit" type="submit" value="提交">
</form>