jeudi 23 juillet 2015

Checkboxes with PHP & SQLExpress Server 2008

I have a local application which currently reads data from a local SQL Server, this works well with SELECT queries and outputting text in a table however I'm having difficulty outputting a checkbox status either checked or unchecked :(

See my code:

<?php
while( $row2 = sqlsrv_fetch_array( $stmt2, SQLSRV_FETCH_ASSOC) ) {
echo "<tr>";
echo "<td>" . "<input class=form-control id=input-readonly type=text name=supcode value=" . $row2['column1'] . " readonly></td>";
echo "<td><input type=checkbox" . if ($row2['checkbox_column1'] ==1) echo "checked='checked'>" . "</td>";
echo "</tr>";
}

sqlsrv_free_stmt( $stmt2);
?>

The checkbox_column1 column is a BIT datatype

Any guidance would be greatly appreciated, thank you!




Aucun commentaire:

Enregistrer un commentaire