Solved

HTML Checkboxes in PHP Script Stored in SQL DB

Posted on 2008-06-25
1
1,085 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Suggested Solutions

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

749 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