我正在尝试将我们的网站迁移到使用 PHP5 的新主机。以前我们在 PHP4 上。
在用户填写以前在 php4 上工作的调查后,我有一个表单没有提交并重定向到感谢页面。我确定这可能很明显我错过了,但我不明白为什么它不起作用。
当我点击提交时,调查页面重新加载,URL 被添加到末尾?submit=t 并且电子邮件没有发送给我。
我们的survey.php 中的代码如下所示,其中我的电子邮件地址和大部分HTML 表单字段都已删除。有人可以指出我正确的方向吗?
谢谢!
<?
$APP_ROOT = "../";
$FILE = __FILE__;
$TITLE="Service Survey";
if(!isset($submit)) {
include($APP_ROOT."include/header.php");
include($APP_ROOT."include/nava.php");
?>
<div class="bodymargin">
<img src="<?=$WEB_ROOT;?>images/titles/<?=$SECTION."_".$FILE;?>.gif" width="400" height="36"><br>
<br>
<form method="POST" action="<?=$FILE;?>.php?submit=t">
<?
if(isset($error)) {
while(list($key, $value) = each($HTTP_GET_VARS)) {
$$key = stripslashes($value);
}
print("<p class=\"alert\">". urldecode($error) . "</p>\n");
}
?>
<input type="text" name="name" value="<?=$name;?>">
</form>
<?
include($APP_ROOT."include/navb.php");
include($APP_ROOT."include/footer.php");
} else {
include_once($APP_ROOT . "functions/index.php");
include_once($APP_ROOT . "functions/form_validation.php");
$CONTINUE = TRUE;
$valid = new Validation($HTTP_POST_VARS);
if($CONTINUE = $valid->success) {
$to = "myemailaddress";
$subject = "Service Survey";
$from_email = $to;
$from_name = "mysite.com";
$headers = "From: $from_name<$from_email>\n";
$headers .= "Reply-To: <$email>\n";
$headers .= "Return-Path: <$from_email>\n";
$body = "The following information was just posted \n";
unset($HTTP_POST_VARS['required_fields']);
reset($HTTP_POST_VARS);
while(list($key, $value) = each($HTTP_POST_VARS)) {
if(!empty($value)) {
$body .= proper_form($key) . ": " . stripslashes($value) ."\n";
}
}
$body .= "\nThis is an automated message, please do not respond.";
mail($to,$subject,$body,$headers);
$URL = $WEB_ROOT . "/customer/thanks.php?form=" . $FILE;
server_redirector($URL);
} else {
while(list($key, $value) = each($HTTP_POST_VARS)) {
$rebound .= "&$key=" . urlencode(stripslashes($value));
}
$URL = $WEB_ROOT . "customer/survey.php?error=". urlencode(nl2br($valid->errors)) . $rebound;
server_redirector($URL);
die();
}
}
?>