I am almost embarrassed to ask this, but I have been staring at it and feel like there is an easy answer but i'm not seeing/finding it.
I have this line in my php where i am using a string "checked" to check a checkbox.
<input type='checkbox' name='hikeL[]' id=".$row["ID"]." ".$row["Chk"].">
I am trying to convert so that I can make it more powerful.. e.g. use a 1 or 0 to affect multiple things vs just checking the checkbox. I have tried changing it to this, but there is clearly a syntax issue that I haven't been able to resolve.
<input type='checkbox' name='hikeL[]' id=".$row["ID"]." ".$row["Chk"].==1 ? "checked" : "" ">
this is all being echo'd in a 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 would be great.. kind of new to mySql and php, so much appreciated..