I've got a site where you can buy products. I made a shopping cart with the use of sessions. I've made a table which shows te products. After each produkt there's a button. When you click a button the product is added to the database (i use forms). But only the first word is added. Example: "Chaintech BNC JTX 300 Watt" [button]. When i click the button only the word 'Chaintech' is added to the database. The field where the data is stored is a varchar with a lengt of 200 .What am i doing wrong?....
Excuse me for the bad english
You need to use the primary key of each product in the database rather than the string. That should solve your woes and create a better application.
As for your answer, htmlspecialchars your string, but for a better answer, use the key.