0

我的表单不断重定向回主联系页面......所以即使按下提交按钮,它也不会处理,这意味着$_POST['contactsent']“是”并且表单应该处理。

HTML 表单片段

<form method="post" action="process.php" id="form1">
<input type="hidden" value='yes' name="contactsend" />

PHP表单流程

if ($_POST['contactsent'] != 'yes') {
    header ('Location: /contact');
    exit;
} else {

    if (is_array($_POST)) {
        foreach ($_POST as $key => $value) {
            $_POST[$key] = mysql_real_escape_string(stripslashes($value));
        }
    }

    $uxRequestType      = $_POST["uxRequestType"];
    $uxGlobalLocation   = $_POST["uxGlobalLocation"];
    $uxFirstName        = strtolower(str_replace("'","''",$_POST["uxFirstName"]));
    $uxFirstName        = strtoupper(substr($uxFirstName,0,1)).substr($uxFirstName,1);
    $uxLastName         = strtolower(str_replace("'","''",$_POST["uxLastName"]));
    $uxLastName         = strtoupper(substr($uxLastName,0,1)).substr($uxLastName,1);
    $uxEmail            = strtolower(str_replace("'","''",$_POST["uxEmail"]));
    $uxCity             = strtolower(str_replace("'","''",$_POST["uxCity"]));
    $uxCity             = strtoupper(substr($uxCity,0,1)).substr($uxCity,1);
    $uxState            = $_POST["uxState"];
    $uxComment          = $_POST["uxComment"];

    if ($uxGlobalLocation == "host1"):
        $SendTo="caninfo@--.com";
    elseif ($uxGlobalLocation == "host2"): 
        $SendTo="cvice@--.com";
    else:
        $SendTo="info@--.com";
    endif;
4

4 回答 4

3

Contactsend 和contactsent ... 错字?

于 2012-05-04T16:06:08.607 回答
2

您错误地命名了变量:

if ($_POST['contactsent'] != 'yes') {

应该

if ($_POST['contactsend'] != 'yes') {
于 2012-05-04T16:06:17.793 回答
2
<input type="hidden" value='yes' name="contactsend" />

if ($_POST['contactsent'] != 'yes') {

他们都需要是“contactsend”或“contactsent”

于 2012-05-04T16:07:31.443 回答
1

一个键名为“contactSEND”,另一个键名为contactSENT

于 2012-05-04T16:06:27.450 回答