2015-10-17 38 views
0

我不知道我在這裏錯了。我這樣做就像我以前一樣,但表單變量沒有傳遞給URL。PHP表單變量沒有傳遞到URL

我的代碼如下:

<form id="update_submit" name="update_submit" method="post" action="profile_update.php" > 
    <h3 class="ghj" style="color:white"> 
     <input style="background:rgba(0,0,0,0);border:2px solid #D8D8D8;color:white;" type="text" id="name1" name="name1" value="<?php echo $fullname_1; ?>" required /> | 
     <input style="background:rgba(0,0,0,0);border:2px solid #D8D8D8;color:white" type="text" id="city" name="city" value="<?php echo $city_1; ?>" required /> 
    </h3> 
    <div class="bs-example"> 
     <table class="table"> 
      <tbody> 
       <tr> 
        <td style="color:white"> 
         <h1 style="color:white;font-size:150%" class="head" id="h1.-bootstrap-heading"> 
          <span style="background-color: black;"> 
           <input style="width:400px;background: grey;border: 2px solid #D8D8D8;color:grey" type="text" id="email" name="email" value="<?php echo $email_1; ?>" required disabled /> 
          </span> 
         </h1> 
         <span style="background-color: black;"> 
          Phone : <input style="background: rgba(0, 0, 0, 0);border: 2px solid #D8D8D8;color:white" type="text" id="phone" name="phone" value="<?php echo $phone_1; ?>" required /> 
         </span> 
        </td> 
        <td class="type-info"></td> 
       </tr> 
      </tbody> 
     </table> 
    </div> 
</div> 
<div class="submit-btn"> 
    <input type="submit" value="Update" style="background-color: #585858;color:white"> 
</div> 
</form> 

任何幫助將是非常有用的。

+0

什麼是預期的行爲? 「傳遞給URL」是什麼意思? –

+0

當我按提交按鈕...然後url應該被重定向到profile_update.php像這樣/mysite.com/if/profile_update.php – Deva

+0

所以你不想通過URL傳遞變量,而是傳遞給你的腳本('profile_update.php'),而不會將它們添加到URL – Berriel

回答

2

你需要get方法,編輯表格:

<form id="update_submit" name="update_submit" method="get" action="profile_update.php" > 

Get方法把變量中的URL,POST方法把在HTTP頭變量。

+0

爲什麼得到?我總是使用後,但它的工作原理 – Deva

+0

get方法把變量放在url中,post方法把變量放在http頭文件中。 – fico7489

0

注意輸入郵件的禁用屬性,這個值不會被髮布。也許你應該只使用readonly。

+0

但其他變量應該通過? – Deva

+0

@Deva是的,我測試你的表單在我的本地服務器上,他們通過。 – Thesee

+0

那麼最新錯誤在我的服務器.. :-( – Deva

0

您必須更改如何發送表單的方法。你有幾個選項,GET和POST。


  • 得到默認。追加表單數據以名稱/值對的URL:URL名稱=值&名稱=值
  • 的形式發送數據作爲HTTP交易後

注意?這個的。

所以使用GET更改methodGET

例子: <form id="update_submit" name="update_submit" method="GET" action="profile_update.php">