Umm... one VERY important thing. I know this might just be a test project that nobody but you will ever see. I know that your first real project might be for a small company who only has two customers a year but...
The only way to learn security is to do it right from the beginning and learn good habits.
In the code sample that I gave you above, I was just trying to fix the problem with the quotes. I didn't fix the HUGE security hole in your code.
You are taking the input from the user and passing it right to MySQL. That is very dangerous. You need to either (A) check to see if the data is acceptable or (😎 sanitize the data.
There are a million instruction manuals around the Internet that will teach you how to do that so I won't try to provide a comprehensive tutorial here. Google for SQL injection.
Here's a hint about what the problem is:
Imagine if you asked me my name and I said:
eric'); delete from customers;
You will learn about the mysql_real_escape_string. That will solve HALF the SQL Injection problem. The other half is a little harder to solve and takes about an hour to learn.