I have a php page, with a simple form with some text areas within.
<textarea rows="4" name="issue" style="width:90%;"></textarea>
The form is submitted as a POST to another php page. I capture it as:
$ins_issue = nl2br($_POST['issue']);
I then write it to MySQL with an insert statement. (which is not working for all special characters. Commas for example break the query)
$ins_query = ("INSERT INTO data1 (
p_key_project,
category,
issue,
proposed_resolution,
action_items,
owner,
status,
archived
) VALUES (
'$passed_key',
'$cat_1',
'$ins_issue',
'$ins_resolution',
'$ins_action',
'$ins_owner',
'$ins_status',
'n'
)");
What I'm trying to do is capture ALL special characters that are entered (spaces, line breaks, 's, colons, semi colons, etc ....) and write them to MySQL (I choose TEXT as the datatype in MySQL when I setup the table.)
When I then do a select from MySQL, and pre-populate the text area on the page, I want ALL characters to show up. Line breaks to be there, etc ....
What is the best way to accomplish this so that Anything that someone might paste into the textarea remains 100% intact and exact?