Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > HTML > HTML Code Clinic
HTML Code Clinic Do you have some HTML code you'd like to share and get suggestions from others for tweaking or improving it? This discussion is the place.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the HTML Code Clinic section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old October 21st, 2009, 10:21 AM
Friend of Wrox
Join Date: Oct 2006
Posts: 112
Thanks: 12
Thanked 0 Times in 0 Posts
Default <input type="Checkbox" question???

Hi to all...

Using a input type checkbox or radio button can I set it as checked when reading data of a table in a database…
I have a table with info which 3 of the fields are bits so which holds 0 or 1…
When displaying on screen can I make it checked when it returns a 1 ???

Hope I made it clean…

thanking you in advacnce
Old October 26th, 2009, 06:00 AM
Authorized User
Join Date: Jul 2008
Posts: 18
Thanks: 0
Thanked 2 Times in 2 Posts

i have used php as server side script

$selected  = ($dbValue == 1)?"checked=checked":"";
Your HTML should be,
 <input type='checkbox' name='chk1' <?php echo $selected?> >
The Following User Says Thank You to surya For This Useful Post:
RinoDM (November 9th, 2009)

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to theme the "Browse" button of "FileUpload" control? varunbwj BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 2 October 14th, 2009 01:22 AM
<deployment retail="true"> clarification jsymons BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 1 October 1st, 2009 02:48 PM
Add a CheckBox DataColumn to my DataGridView, Null format: "" or "True" but Error: F ismailc C# 2005 0 September 25th, 2009 04:56 AM
<authentication mode="Forms"/> msman88 ASP.NET 3.5 Professionals 10 August 30th, 2009 08:57 AM
Code not going as planned: "icicle" vs "savedinstancestate" joopthecat BOOK: Professional Android Application Development ISBN: 978-0-470-34471-2 3 May 3rd, 2009 03:09 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.