Reputation: 527
how can I auto check the checkbox based on the value from the database? I have the following code:
<input type="checkbox" name="CarModel" value="Yes" ($row[CarModel]==Audi? 'checked' : '') >
Upvotes: 0
Views: 1618
Reputation: 608
it should be like this
<input type="checkbox" name="CarModel" value="Yes" <?php echo ($row['CarModel'] == 'Audi' ) ? 'checked' : NULL ; ?> >
Upvotes: 2