I'm having some trouble getting the required fields option to work in Jack's formmail.php script. I'm hosting with Godaddy (Linux plan) and using PHP v5.2. I've made the required updates as outlined in this blog post by robertc to get the script to work with PHP5.

The script worked great when I changed all instances of $HTTP_POST_VARS to $_POST, and then made the changes to the $redirect, $subject and $email variables as suggested. However, when I replace the following code, as outlined in the comments:


if ($required)
$require = $required;
// handle the required fields
if ($require) {
// seperate at the commas
$require = ereg_replace( " +", "", $require);
$required = split(",",$require);


... with this code:


// handle the required fields
if (isset($_POST['require'])|isset($_POST['required'])) {
// seperate at the commas
$require = ereg_replace( " +", "", isset($_POST['required'])?$_POST['required']:$_POST['require']);
$required = split(",",$require);


I get the following error: "Warning: Header may not contain more than a single header, new line detected. in ....... on line 128".

I tried replacing both the entire section of original code above, as well as leaving the first two lines, but neither worked. I couldn't find a way to attache the script in it's entirety to this post, but if you need to see it let me know and I can email it to you. Any help would be greatly appreciated. (By the way, in case it's not apparent - I have no PHP experience). Thanks.