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

解决方案 »

  1.   

    1、只显示,不可操作<form method="post" name="addform" action="/secondHouse/rank_add_act.php">
      <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>
      

  2.   

    改成这样就可以了<form method="post" name="addform" action="/secondHouse/rank_add_act.php">
      <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>
      

  3.   

    thanks..2楼的,可checkbox显示出的样式,让人感觉是可操作的呀,没有体现出不可操作的样子出来,
      

  4.   

    disabled="disabled"或者 onclick="return false;
      

  5.   

    PHP取多个checkbox的值
    <?php
     foreach($_POST['price'] as $key=>$value)
     {
      switch ($value)
    {
    case 1:
      echo '20-30万<br/>';
    break;
    case 2: 
    echo '30-40万<br/>';
    break;
    }
     };
    ?>
      

  6.   

    <form method="post" name="addform" action="">
      <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>
      

  7.   

    <form method="post" name="addform" action="">
      <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>
      

  8.   

    2 提交表单时,要得到checkbox的值<?php
    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>
      

  9.   

    哦,checkbox好像只有disabled="disabled"