如何显示已选中复选框的值?

时间:2013-10-03 07:56:45

标签: php checkbox

$section = mysql_query("SELECT services.services, services.price FROM services WHERE pet_breed = 'Dog'");

    while ($row = mysql_fetch_array($section))
   {

    echo "<br><input type='checkbox' id=check data-price='".$row['price']."' class='service' name='pet[]' value ='".$row['services']."'";
    echo " />";
    echo $row['services'];

   }

1 个答案:

答案 0 :(得分:0)

如果您有数据,则应使用“已检查”属性。更多请看到这个 http://www.w3schools.com/tags/tryit.asp?filename=tryhtml_input_checked

<input type="checkbox" name="vehicle" value="Car" checked> I have a car