Solved

HTML Checkboxes in PHP Script Stored in SQL DB

Posted on 2008-06-25
1
1,079 Views
Last Modified: 2013-12-12
I want to add checkboxes to my PHP page. I need help with the following:

1) What 'type' should the SQL entries be? (test1, test2, test3)
2) Can you validate that my HTML table is correct?
<table>

 <tr>

  <td>

   <form name='examples' method='POST' action="test.php">

    <input type="checkbox" name="test1"<?php if($item['test1'] == "on"){echo" CHECKED";}?>>test1<br>

    <input type="checkbox" name="test2"<?php if($item['test2']== "on"){echo" CHECKED";}?>>test2<br>

    <input type="checkbox" name="test3"<?php if($item['test3'] == "on"){echo" CHECKED";}?>>test3<br>

    <input type="submit" name="submit" value="Submit">

   </form>

  </td>

 </tr>

</table>

Open in new window

0
Comment
Question by:deharvy
1 Comment
 
LVL 4

Accepted Solution

by:
albuitra earned 500 total points
ID: 21869878
you can use int, varchar, etc
for example, use varchar(3), and store 'on' and 'off'
or use int, and store 0 and 1
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Load google maps api into wordpress 5 37
mysqli 3 22
PHP: concatenate query 13 39
running code or pseudo code of table structure 5 0
As a database administrator, you may need to audit your table(s) to determine whether the data types are optimal for your real-world data needs.  This Article is intended to be a resource for such a task. Preface The other day, I was involved …
I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
The viewer will learn how to count occurrences of each item in an array.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now