I have a PHP form that gathers user input which I store in a mySql table.
A textbox gathers request data and places it in the var $request.
I run the following query to store the entered data in the table:
//Insert variables into table of previously selected DB.
$query = mysql_query("INSERT INTO requests VALUES ( '$ind', '$new_customer_id', '$gender', '$last_name', '$first_name', '$full_name', '$company', '$street', '$suburb', '$city', '$state', '$zipcode', '$country', '$email_address', '$full_phone', '$request_date', '$subject', '$request', '$please_respond', '$request_date', '$request_status', '$date_finished')");
Problem:
When a user enters a word with an aphostrophy like I'm or can't it throws an error:
"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'm here!', 'Yes', '2005-05-07', '', '')' at line 1"
QUESTIONS:
What must I do in order to capture WHATEVER the user types into that textbox?
A textbox gathers request data and places it in the var $request.
I run the following query to store the entered data in the table:
//Insert variables into table of previously selected DB.
$query = mysql_query("INSERT INTO requests VALUES ( '$ind', '$new_customer_id', '$gender', '$last_name', '$first_name', '$full_name', '$company', '$street', '$suburb', '$city', '$state', '$zipcode', '$country', '$email_address', '$full_phone', '$request_date', '$subject', '$request', '$please_respond', '$request_date', '$request_status', '$date_finished')");
Problem:
When a user enters a word with an aphostrophy like I'm or can't it throws an error:
"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'm here!', 'Yes', '2005-05-07', '', '')' at line 1"
QUESTIONS:
What must I do in order to capture WHATEVER the user types into that textbox?