Loading

store checkbox value in mysql

7 posts / 0 new
Last post
Offline
Joined: 10/25/2009
store checkbox value in mysql

how to store selected checkbox value to mysql database...explain in detail....

admin's picture
Offline
Joined: 11/14/2008
re: store checkbox value in mysql

Whether you work with MySQL or MS Access/SQL Server the concept is still the same. Study my "Database Programming Made Easy" to get started.

Anonymous
am stuck

i am a student and i want to try to develop a bookshop system but i am failing to show that a book has been sold on an interface and how to implement this---please help me

roseann's picture
Offline
Joined: 11/05/2009
@sujitha

hi sujitha, do you know about PHP array?

you can store check box value by making it an array and serialize when calling it.

Please Research about PHP Array Serialize.

Thanks,

janzell

Offline
Joined: 12/20/2011
Try this
  1. <?php
  2. if(isset($_GET['submit']) && !empty($_GET['checkbox_value'])){
  3. $chk = $_GET['checkbox_value'];
  4. echo "Checkbox's value is '{$chk}' ";
  5. echo "<b/>" ;
  6. }else{
  7. echo "Check to see my value and then submit...";
  8. }
  9. ?>
  10. <form action="#" action="GET">
  11. <input type="checkbox" name="checkbox_value" value="I'm selected" /><br/>
  12. <input type="submit" name="submit" value="submit" />
  13. </form>

what the code above does is it returns the value of checkbox when the the form is submitted.. Ofcourse you need to assign a value to the checkbox:
<input type="checkbox" name="checkbox_value" value="some value here"  />

gtwebworx dot com

Offline
Joined: 12/20/2011
in your query: "insert into

in your query: "insert into `mydatabase`.`table`('ID','Value') Values('',{$_GET['checkbox_value']})"..etc.

gtwebworx dot com

Anonymous
I just want to share you the

I just want to share you the idea on how to accomplish thing like this.
all you need to learn is Array and how to store Array into database, you can find a lot in the net ;)

Pages

Add new comment

Filtered HTML

  • You may insert videos with [video:URL]
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <asp>, <c>, <cpp>, <csharp>, <css>, <html4strict>, <java>, <javascript>, <mysql>, <php>, <python>, <sql>, <vb>, <vbnet>. The supported tag styles are: <foo>, [foo].
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.