I have an form which sends some data to an success page, and there they are inserted in a database.
Therefore I don't have control of what there is in the data from the form. And if the user uses single quotes the data doesn't get to the database. How can I secure the user don't use single quotes in the form?
Here is my code:
$details = $this->getDetails();
$conferance_name = $details['product_name'];
$hotel = $details['hotelval'];
$datefor = $details['dateval'];
$ogtitel = $details['navn_title'];
$virksomhed = $details['virksomhed'];
$adresse = $details['adresse'];
$postnr = $details['postnr'];
$by = $details['by'];
$telefon = $details['telefon'];
$email = $details['email'];
$kommentarer = $details['kommentarer'];
$ean = $details['ean'];
$entries = $details['entries'];
$newdate = date('Y-m-d')
$conn = Mage::getSingleton('core/resource')->getConnection('core_write');
$sql = "INSERT INTO mage_emailorder (emailorder_id, order_date, product_name, location, date_for, name_title, email, company, adress, zipcode, city, phone, ean, comment, order_done, number_of_entries)
VALUES (NULL, '$newdate', '$conferance_name', '$hotel', '$datefor', '$ogtitel', '$email', '$virksomhed', '$adresse', '$postnr', '$by', '$telefon', '$ean', '$kommentarer', '0', '$entries')";
All the variables are from a form, and I want to secure the form, from special symbols.