Hey,
I'm trying to use something like this to escape quotes on text date from forms to be written to a database:
// escape quotes and apostrophes if magic_quotes_gpc off
if (!get_magic_quotes_gpc()) {
foreach($_POST as $key=>$value) {
$temp = addslashes($value);
$_POST[$key] = $temp;
}
}
Problem is this seems to return an empty array for any checkbox or radio button array submitted with the form, causing SQL syntax errors when trying to handle id's for those elements.
Is there a way to check the type of form element in the $_Post array so I can avoid applying the above function to checkboxes/radio buttons?
Or any other advice on escaping quotes across the board when writing to a db would be much appreciated,
Thanks!