2011-04-30 54 views
0

我遇到的問題是我的值沒有通過我的PHP代碼。我將php文件路徑名放在下面表單的action部分,並將驗證的Javascript代碼附加到submit按鈕。我在php中訪問的唯一值是複選框和廣播值。訪問收音機和複選框值以外的任何值

** * ** * ** * *HTML* ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * *

<div id="right-cont"> 

     <form name = "contact_Us" action="http://nova.umuc.edu/cgi-bin/cgiwrap/ct386a28/eContact.php" method = "post"> 

      <div id="style2"> 
       <p>Please enter contact information below:</p>         
      </div> 

      <div class="style7"> 
       <label>First Name: </label> 
       &nbsp;<br /><input type="text" id="firstName" tabindex="1" 
        style="width: 176px" /> 
      </div> 

      <div class="style7"> 
       <label>Middle Name: </label> 
       &nbsp;<br /><input type="text" id ="middleName" tabindex="2" 
        style="width: 176px" /> 
      </div> 

      <div class="style7"> 
       <label>Last Name: </label> 
       &nbsp;<br /><input type="text" id ="lastName" tabindex="3" 
        style="width: 176px" /> 
      </div> 

      <div class =" buttons"> 
      <input type="submit" value="SUBMIT" onclick = "return validate()"/><input type="reset" value="CLEAR"/> <br />     
      </div>  

     </form> 

    </div> 

** * ** * ** * ** * ** * **個PHP代碼* ** * ** * ** * ** * ** * ** * *

 <?= '<' . '?xml version="1.0" encoding="utf-8"?' . '>' ?> 

     <?php  
     $fName = $_POST["firstName"]; 
     $lName = $_POST["lastName"]; 
     $mName = $_POST["middleName"]; 
     $email = $_POST["email"]; 
     $phone = $_POST["phone_Num"]; 
     $comment = $_POST["comment"]; 
     $phone_Type = $_POST["phone"]; 
     $specialty_Type = $_POST["specType"];  
     ?> 

     <div id="right-cont">  


      <div style="style8"> 
       <h2>The Below Information has been sent to Pierre Law, LLC:</h2>         
      </div> 

      <div class="style7"> 
       <label>First Name: </label> 
       <?php echo $fName; ?> 
      </div> 

      <div class="style7"> 
       <label>Middle Name: </label> 
       <?php echo $mName;?> 
      </div> 

      <div class="style7"> 
       <label>Last Name: </label> 
       <?php echo $lName;?> 
      </div> 
     </div>   

回答

3

輸入標籤缺少名稱屬性。請求數據以「NAME = VALUE」的形式發送。你只能放入元素的ID。您可以在輸入元素中使用id屬性的值相同的名稱和值將在PHP代碼接收

+0

Dooh!坦克星期一:) – Mike 2011-04-30 13:22:39

1

這是應該的樣子:

<div class="style7"> 
    <label for="firstName">First Name: </label> 
    <input type="text" name="firstName" id="firstName" tabindex="1" /> 
</div> 

輸入的寬度應該來自.style7 input{} css規則和,停止使用<br />&nbsp;進行格式化,這就是css的用途。

P.S. css類的名稱應該描述標籤的內容('文章','重要'等)。並且表格是字段列表

+0

感謝您的幫助。我很感激! – Mike 2011-04-30 13:44:16