I'm getting this error in Firefox when trying to process a form and then re-direct the user (via php header) to the correct page depending on whether or not the form was filled in correctly.
The page isn't redirecting properly
Firefox has detected that the server is redirecting the request for this address in a way that will never complete.
In Internet Explorer, the page is not submitted at all, and the browser just gets hung up processing it.
It should be noted that the scripts works perfectly on my usual server, but is getting the above errors on another. I'm wondering if maybe it's because I re-direct to different headers using "if" statements and if this causes it to be confused somehow. Here's the relevant excerpt of the code:
if ($contest_status != "active" || $banned != "0" || $num_email_entries == $contest_maxperperson ||
($contest_enddate < $today_date && $contest_enddate != "1969-12-31")) {
// The above lines check to make sure entries are still being accepted
// ie: contest is active, email is not banned, etc.
[B]header("Location: $source?status=statuserror");[/B]
} elseif (($rf_name == "Y" && !$entry_name) || ($rf_email == "Y" && !$entry_email) ||
($rf_address == "Y" && (!$entry_address || !$entry_city || !$entry_state || !$entry_country || !$entry_zipcode)) ||
($rf_phone == "Y" && !$entry_phone) || ($rf_birthdate == "Y" && (!$entry_birthdate_day || !$entry_birthdate_month ||
(!$entry_birthdate_year || $entry_birthdate_year == "YYYY"))) || ($rf_gender == "Y" && !$entry_gender) ||
($rf_occupation == "Y" && !$entry_occupation) || ($rf_custom1 && !$entry_custom1) || ($rf_custom2 && !$entry_custom2) ||
($rf_custom3 && !$entry_custom3) || ($rf_custom4 && !$entry_custom4) ||
($rf_custom5 && !$entry_custom5)) {
// The above line checks to make sure all required fields are filled in.
[B]header("Location: $source?status=fieldserror");[/B]
} else { // If all required fields are filled in (add entry)
$entry_birthdate = $entry_birthdate_year . "-" . $entry_birthdate_month . "-" . $entry_birthdate_day;
$sql = "INSERT INTO `$entries_table` (`id`,`date`,`contest_id`,`name`,`email`,`address`,`city`,`state`,`country`,`zipcode`,
`phone`,`birthdate`,`gender`,`occupation`,`custom1`,`custom2`,`custom3`,`custom4`,`custom5`,`status`,`winner`) VALUES ('',NOW(),'$id','$entry_name','$entry_email','$entry_address','$entry_city','$entry_state','$entry_country','$entry_zipcode',
'$entry_phone','$entry_birthdate','$entry_gender','$entry_occupation','$entry_custom1','$entry_custom2','$entry_custom3','$entry_custom4',
'$entry_custom5','active','')";
$add_item = mysql_query($sql);
if ($contest_confirmemail == "Y") {
if ($rf_name == "Y") {
$entry_info .= "Name: " . $entry_name . "\n";
}
if ($rf_email == "Y") {
$entry_info .= "E-mail: " . $entry_email . "\n";
}
if ($rf_address == "Y") {
$entry_info .= "Mailing Address: " . $entry_address . "," . $entry_city . "," . $entry_state . "," . $entry_country . "," . $entry_zipcode . "\n";
}
if ($rf_phone == "Y") {
$entry_info .= "Phone Number: " . $entry_phone . "\n";
}
if ($rf_birthdate == "Y") {
$entry_info .= "Birthdate: " . $entry_birthdate . "\n";
}
if ($rf_gender == "Y") {
$entry_info .= "Gender: " . $entry_gender . "\n";
}
if ($rf_occupation == "Y") {
$entry_info .= "Occupation: " . $entry_occupation . "\n";
}
if ($rf_custom1) {
$entry_info .= $rf_custom1 . ": " . $entry_custom1 . "\n";
}
if ($rf_custom2) {
$entry_info .= $rf_custom2 . ": " . $entry_custom2 . "\n";
}
if ($rf_custom3) {
$entry_info .= $rf_custom3 . ": " . $entry_custom3 . "\n";
}
if ($rf_custom4) {
$entry_info .= $rf_custom4 . ": " . $entry_custom4 . "\n";
}
if ($rf_custom5) {
$entry_info .= $rf_custom5 . ": " . $entry_custom5 . "\n";
}
$replace = array("<%entry_name%>", "<%contest_name%>", "<%entry_info%>", "<%admin_name%>");
$with = array("$entry_name", "$contest_name", "$entry_info", "$admin_name");
$subject = str_replace($replace, $with, $contest_confirmsubject);
$subject = stripcslashes($subject);
$replace = array("<%entry_name%>", "<%contest_name%>", "<%entry_info%>", "<%admin_name%>");
$with = array("$entry_name", "$contest_name", "$entry_info", "$admin_name");
$message = str_replace($replace, $with, $contest_confirmmessage);
$message = stripcslashes($message);
$message = nl2br($message);
$myname = $admin_name;
$myemail = $admin_email;
$contactname = $entry_name;
$contactemail = $entry_email;
$message = $message;
$subject = $subject;
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: ".$myname." <".$myemail.">\r\n";
$headers .= "Reply-To: ".$myname." <$myemail>\r\n";
$headers .= "X-Priority: 1\r\n";
$headers .= "X-MSMail-Priority: High\r\n";
$headers .= "X-Mailer: Server";
mail($contactemail, $subject, $message, $headers);
} // if confirmation e-mail is enabled
[B]header("Location: $source?status=complete");[/B]
} // end if fields are filled in
Any help on what could be going wrong here would be appreciated.
Thanks.