mySql and PHP syntax.. something simple is missing -
i embarrassed ask this, have been staring @ , feel there easy answer i'm not seeing/finding it.
i have line in php using string "checked" check checkbox.
<input type='checkbox' name='hikel[]' id=".$row["id"]." ".$row["chk"]."> i trying convert can make more powerful.. e.g. use 1 or 0 affect multiple things vs checking checkbox. have tried changing this, there syntax issue haven't been able resolve.
<input type='checkbox' name='hikel[]' id=".$row["id"]." ".$row["chk"].==1 ? "checked" : "" "> this being echo'd in greater statement...
while($row = $result->fetch_assoc()) { echo "<tr class=''> <td class='hikeselement'> <form action='checkbox.php' method='post'> <input type='checkbox' name='hikel[]' id=".$row["id"]." ".$row["chk"]."> </form> </td> </tr>"; } any thoughts great.. kind of new mysql , php, appreciated..
you seem miss dot before "> , brackets:
<input type='checkbox' name='hikel[]' id=".$row["id"]." ".($row["chk"]==1 ? "checked" : ""). ">
Comments
Post a Comment