Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1102
  • Last Modified:

HTML Checkboxes in PHP Script Stored in SQL DB

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
deharvy
Asked:
deharvy
1 Solution
 
albuitraCommented:
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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now