2016-09-16 95 views
0

我的代碼是一個簡單的HTML表單,帶有一個用於edit password的按鈕。我試圖讓它在PHP中工作,但是在將facebook.com作爲一個動作輸入後,它什麼也不做。爲什麼提交按鈕不起作用?

下面是代碼:

<form name="sentMessage" id="contactForm" action="https://www.facebook.com" method="POST"> 
    <div class="row control-group"> 
     <div class="form-group col-xs-12 floating-label-form-group controls"> 
      <label>Current Password</label> 
      <input type="password" class="form-control" placeholder="Current Password" name="Current Password" id="name" required data-validation-required-message="Please enter your current password." > 
      <p class="help-block text-danger"></p> 
     </div> 
    </div> 
    <div class="row control-group"> 
     <div class="form-group col-xs-12 floating-label-form-group controls"> 
      <label>Password</label> 
      <input type="password" class="form-control" placeholder="New Password" name="New Password" id="name" required data-validation-required-message="Please enter your new password." > 
      <p class="help-block text-danger"></p> 
     </div> 
    </div> 
    <div class="row control-group"> 
     <div class="form-group col-xs-12 floating-label-form-group controls"> 
      <label>Re-enter Password</label> 
      <input type="password" class="form-control" placeholder="Re-enter Password" name="Re-enter Password" id="name"required data-validation-required-message="Please re-enter your password." > 
      <p class="help-block text-danger"></p> 
     </div> 
    </div> 
    <br> 
    <div id="success"></div> 
    <button class="btn btn-success btn-lg" data-toggle="modal" style="padding:10px 20px;width:100px;" type="submit">Edit</button> 
    <button type="button" class="btn btn-default btn-lg" data-dismiss="modal" style="padding:10px 20px;width:100px;"><i class="fa fa-times"></i> Close</button> 
</form> 
+0

URL處於'action'期望交叉源'POST'? – guest271314

回答

0

你不能只是張貼值www.facebook.com或任何其他網站,因爲他們是這些網站沒有代碼,即可獲得您所發佈的值。

+0

我只是把facebook.com進行測試,如果按鈕做了任何動作或沒有做任何事情 –

+0

Facebook不允許跨源請求,你最好閱讀關於跨源請求。 –

0

你真的想在facebook.com上發佈一些東西嗎?如果這是你想要的,你不能那樣做。特別是Facebook安全網站不僅允許在其網站上發佈POST或GET請求的隨機子代。

+0

不,當然這不是我想 我只是把facebook.com用於測試,如果按鈕做任何動作或不 ,它不會做任何事情 –

+0

我用你的確切代碼,然後使用JavaScript提交表單。提交的表格,我被重定向到facebook.com,說「請求無法處理」。簡而言之,表單能夠向Facebook提交請求,但它只會重定向到網站。沒有進一步的行動會發生 – Redis1001

+0

你能告訴我你如何使用JavaScript來提交表單? –