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!

Posted on May 25th, 2007 | Leave a comment | Trackback URL

4 Comments

  1. Maryam

    April 17th, 2008

    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. LearningNerd

    April 18th, 2008

    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. MSQL, PHP & Tick Boxes | Stevp's Blog

    June 19th, 2008

    […] I’ve done loads of reading and searching and found pieces of the puzzle all over the net. This video however was most useful, although it isnt quite what i’m after it helped get my head round a […]

  4. Carl

    June 25th, 2008

    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!

Share Your Thoughts