i modified cupcakes.php as you had a lot of duplicate code in there.
I set up server side validation for add to cart form 3, which is for all simple cupcakes.
i also changed your recordsets so all data comes from a table called cupcake1, (as i had this table with all of your items which i used to help you with your image display in an earlier post) and just filtered by product type
if you take a look at the code, it should be clear.
attached is the updated page