2012-05-04 67 views
0

我的表單不斷處理重定向回主聯繫頁面......所以即使提交按鈕被按下,意味着$_POST['contactsent']是「是」並且表單應該處理,但它不處理。php FORM腳本沒有處理

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="[email protected]"; 
    elseif ($uxGlobalLocation == "host2"): 
     $SendTo="[email protected]"; 
    else: 
     $SendTo="[email protected]"; 
    endif; 

回答

3

Contactsend和contactsent ......錯字?

+0

很好的眼睛......謝謝。 – acctman

2

你誤命名您的變量:

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

應該

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

一個鍵被命名爲 「contactSEND」,另一種是contactSENT

2
<input type="hidden" value='yes' name="contactsend" /> 

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

他們都需要「contactsend」或「contactsent」