I have trouble sanitizing my array and am hoping someone can take a look!
here is my input:
<input type="text" name="courseno[]" id="courseno" size="12" />
here is my function to sanitize my data:
function sanitizeData ($datastring) {
if (is_array($datastring)) {
foreach ($datastring as $indivdata) {
$indivdata = sanitizeData($indivdata);
}
}
else {
$datastring=trim($datastring);
$datastring=htmlspecialchars($datastring);
$datastring = mysql_real_escape_string($datastring);
return $datastring;
}
}
if (isset($_POST['courseno'])) {
$courseno = sanitizeData($_POST['courseno']);
}
the $courseno data won't post when I try to sanitize the array, while all my other data gets posted. When I don't sanitize $courseno, the data gets posted to the database just fine.