By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,968 Members | 1,589 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,968 IT Pros & Developers. It's quick & easy.

How to store in MySQL multiple checkbox values using PHP code

P: 2
Expand|Select|Wrap|Line Numbers
  1. <html>
  2.     <head>
  3.         <style type="text/css">
  4.             span
  5.             {
  6.                 color:#FF0000;
  7.                 font-family:Arial, Helvetica, sans-serif;
  8.                 font-size:20px;
  9.             }
  10.         </style>
  11.         <title>FORM</title>
  12.  
  13.         <script type="text/javascript">
  14.             function fun2()
  15.             {
  16.             var co=(document.frm2.course[0].checked==false && document.frm2.course[1].checked==false && document.frm2.course[2].checked==false); 
  17.                 if(co)
  18.                 {
  19.                     document.getElementById("courseerr").innerHTML="Please enter course.";
  20.                     document.frm2.course[0].focus();
  21.                     document.frm2.course[1].focus();
  22.                     document.frm2.course[2].focus();
  23.                     return false;
  24.                 }
  25.                     }
  26.         </script>
  27.  
  28.     </head>
  29.     <body>
  30.         <form action="one.php" method="post" name="frm2" onSubmit="return fun2()">
  31.             <table align="center">
  32.                 <caption align="center">FORM</h2></caption>
  33.                 <tr height="25">
  34.                     <td>Course:</td>
  35.                     <td><input type="checkbox" name="course" value="mca"/>MCA
  36.                         <input type="checkbox" name="course" value="mba"/>MBA
  37.                         <input type="checkbox" name="course" value="msc"/>MSC</td>
  38.                         <td><span id="courseerr"></span></td>
  39.                 </tr>
  40.                 <tr height="25">
  41.                     <td><input type="submit" value="Submit here"/></td>
  42.                     <td><input type="reset" value="Clear me" /></td>
  43.                 </tr>
  44.             </table>
  45.         </form>
  46.     </body>
  47. </html>
Dec 25 '11 #1
Share this Question
Share on Google+
3 Replies


P: 2
please send php code
Dec 25 '11 #2

Dormilich
Expert Mod 5K+
P: 8,639
please send php code
we’re not providing code without you making an effort.
Dec 26 '11 #3

P: 5
checkbox value u can store in string using separator( , ,/, ~,-,etc ),
then store the value in MySQL , and when u retrieve values from MySQL then re-separate value using separator
Dec 26 '11 #4

Post your reply

Sign in to post your reply or Sign up for a free account.