I'm using the script in Ch 13 to prevent spam from entering my form. I created a form based off the book in (Ch 11 Sending Emails) except with an addition of checkboxes. Everything is working except the thank you message after it's sent.
The message: Warning: stripos() expects parameter 1 to be string, array given in /home/content/70/11385670/html/new_view.php on line 49
Thank you for contacting me! I will reply soon.
The message is referring to the line highlighted in red
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
function spam_scrubber($value) {
// List of bad values:
$very_bad = array('to:', 'cc:', 'bcc:', 'content-type:', 'mime-version:', 'multipart-mixed:', 'content-transfer-encoding:');
// If bad values, return empty string:
foreach ($very_bad as $v) {
if (stripos($value, $v)!== false) return '';
}
// Replace any newline characters with spaces:
$value = str_replace(array("\r", "\n", "%0a", "%0d"), ' ', $value);
// Return the value:
return trim($value);
} //End of spam_scrubber() function
Any help would be appreciated!