First PHP/MySQL Project Day 4: Checkboxes and Deleting Rows

Today I learned how to delete rows from a table in MySQL using an HTML form with dynamically generated checkboxes. (Whew, that was a mouthful!) To put it all together, I had to learn about a bunch of different things: how PHP handles checkboxes, primary keys, how to add a column to a table, a couple new MySQL statements, and a new PHP function. The video is eight and a half minutes long.

Links for Checkboxes and Deleting Rows

Here are the examples I copied from:

And here’s more info about the MySQL statements and stuff:

I learned a lot today, that’s for sure!

21 thoughts on “First PHP/MySQL Project Day 4: Checkboxes and Deleting Rows

  1. Hello Dear Liz,

    Thanks for useful issues,
    I have encountered one problem in this example :While I deleted the rows “-tagged “won’t be deleted in none of them.
    Is there any hint for that?

    Thanks for your time and consideration.
    Looking forward for more videos from you .

    Best Regards,
    Maryam

  2. Maryam – Glad you found it helpful! I remember being confused by that “-tagged” line… The solution is probably to just not let the HTML form submit empty inputs in the first place. You should first check if the text inputs actually contain text before inserting them into MySQL. (I should’ve learned how to do that! I will in the future.)

    As for why the row won’t delete, I’m not sure why that is! I still have a lot to learn, obviously. ;)

  3. Pingback: MSQL, PHP & Tick Boxes | Stevp's Blog

  4. Thanks for the tutorial, i’ve been spending days trying to get my form work but when I found your site it took just minutes.

    Once again thank you for saving me time and for the great education!

  5. Hi , could you post the full php files that you create here…it will help us compare and debug …extremely helpful site ,thank you so very much for putting it up ..keep up the good work!

  6. This little video was just the ticket in helping me figure out how to get multiple checkboxes to work!

    I will surely be keeping hold of this piece of PHP coding and will make use of it in several projects :D

    Thank you ever so much!

  7. Hello sir/madam i want to know how to generate check boxes like category example

    main heading
    subheading
    check box 1
    check box 2
    check box 3
    then user select more check boxes from different sub heading and at last send email to the selected items.
    please explain me in detial
    thanks,

  8. Thank you SO much!!! I found another script that worked except it kept giving me an undefined output error. I was so frustrated as I’ve been trying to get this script to work for days. After combining info from your script with what I already have my script now works flawlessly. Keep up the good work!

  9. Thanks for the very clear tutorial! I was really struggling with this concept, trying to wade through a bunch of irrelevant google search results and people giving confusing advice on forums. You really helped me understand!

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>