fergus Posted July 18, 2013 Share Posted July 18, 2013 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! Link to comment Share on other sites More sharing options...
margaux Posted July 18, 2013 Share Posted July 18, 2013 Try doing a var_dump on the variable before you call the spam_scrubber function on it. You will probably see that it is an array. Check how you've coded the checkbox in the form - is it set up as an array? 1 Link to comment Share on other sites More sharing options...
Recommended Posts