I want users to have the ability to enter special characters and for it to still submit to the DB.
I have tested using the input: Dave & ' " *, however it doesn't store in the database. If I don't use special characters as per the above and just use Dave, it stores just fine.
I have tried 2 things:
<p class="clearfix">
<label for="name">name</label>
<input class="validate[required]" id="name" name="name" type="text" value="'.esc_attr($_POST['name']).'">
</p>
and
<p class="clearfix">
<label for="name">name</label>
<input class="validate[required]" id="name" name="name" type="text" value="'.htmlspecialchars($_POST['name']).'">
</p>
Neither work.
Database insertion code after payment:
if(strpos($response['body'], 'VERIFIED') !== false && $_POST['payment_status'] == "Completed") {
//Assign IPN Post Values to Local Variables
$comboString = $_POST['txn_id'].$_POST['payment_date'];
$data = explode('~',$_POST['custom']);
$ipn_data = array(
'name' => mysql_real_escape_string($_POST['name']),
'sale_date' => $_POST['payment_date']
);
$ipn_format = array('%s','%s');
if($ipn_business == $paypal_email) {
$wpdb->insert($wpdb->prefix.'orderdata', $ipn_data, $ipn_format);
$ipn_data['currency'] = $_POST['mc_currency'];
$ipn_data['admin_field'] = $_POST['admin_field'];
send_email($ipn_data);
}
} else {
exit("IPN Request Failure");
}