Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

HTML Checkboxes in PHP Script Stored in SQL DB

Posted on 2008-06-25
1
Medium Priority
?
1,098 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 1500 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

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

Question has a verified solution.

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

Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
In this blog post, we’ll look at how using thread_statistics can cause high memory usage.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

722 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