2013-09-05 42 views
0

我有一個表格形式:爲什麼重定向錯誤

$html.='<div class="grid-round"> 
      <form method="post action=""> 
       <table class="grid-table"> 
        <tr> 
         <th><input type="checkbox" ></th> 
         <th>name</th> 
         <th>type</th> 
         <th>date</th> 
         <th>Stat</th> 
        </tr> 
        ... 
       </table> 
       <button>save</button> 
      </form> 
</div>'; 

它被放置在頁面上地址:

www.example.com/admin?cid=53 & USER_ID = 10

但是當我按下按鈕,我重定向上:

www.example.com/admin

我推出了action=" '.$SERVER[ 'REQUEST_URI' ].' ",但它也沒有幫助。有人可以建議做什麼或問題在哪裏?

+3

你錯過了結束引號後門柱' '。錯字? –

+0

如果你不想提交你的頁面,你可以添加'type ='按鈕''到你的按鈕,否則按鈕會一直提交到你的動作鏈接 – Gil

+0

@Bart Friederichs yep)))你是對的)謝謝) )) – myrko

回答

2

添加報價method="post後:

$html.='<div class="grid-round"> 
      <form method="post" action=""> 
0

你缺少$後下劃線和後

嘗試後一個雙引號:

echo '<form method="post" action="'.$_SERVER['REQUEST_URI'].'" > 
    ...... 
    ...... 
    ......';