I have a form from where I get POST data and I am going through each of them and updating them to the database. But the problem is it doesn't handle quotes properly. It's stripping off at the quote. I tried different approach, but all failed. Please guide.
foreach ($_POST as $param_name => $param_val) {
// code removed for clarity
$data = array($col_name => $param_val);
$where = array($col_id => $col_id_val);
// run the query
$wpdb->update($table_name, $data, $where);
}
If there's an input like What's my name?
for $param_val
, in the database it gets updated as What\'s my name?
.
Please help.