2011-10-26 31 views
0

我有一些不同的PHP表單(25),將處理一些信息。與其爲每個表單創建不同的頁面,是否可以通過從列表或超鏈接中選擇一些內容來在頁面上加載不同的表單?是否可以通過單擊超鏈接或按鈕將不同的HTML表單加載到頁面上?

例如:

如果我想使用形式的話,我點擊形式的,當它重新加載,然後在網頁上顯示的鏈接或按鈕。

讓我知道你是否需要我解釋給你更好的笑聲。

I want it to work the same way that this website does, you click the hyperlink and a different form appears.

+0

聽起來像你找的Jquery – MHowey

+0

在我會使用jQuery這有什麼辦法? – willkara

回答

1

你可以有你單擊以選中表格必須得到重視他們的變量,這樣當重新加載頁面,你可以使用這些變量來決定顯示哪些形式的聯繫。 例如: -

<a href="thispage.php?form=a">form a</a> 
<a href="thispage.php?form=b">form b</a> 
<a href="thispage.php?form=c">form c</a> 

<? 
switch ($_GET['form']) 
{ 
    case 'a': 
     ?> 
     <form method="POST" action="thispage.php"> 
      <!-- form a elements here :) --> 
     </form> 
     <? 
     break; 
    case 'b': // show form b 
     ?> 
     <form method="POST" action="thispage.php"> 
      <!-- form b elements here :) --> 
     </form> 
     <? 
     break; 
    case 'c': // show form c 
     ?> 
     <form method="POST" action="thispage.php"> 
      <!-- form c elements here :) --> 
     </form> 
     <? 
     break; 
} 
?> 
+0

我明白你在說什麼的前提下,但我怎麼實際上指定它使用「形式」? 「form a」的代碼在哪裏,以及「case a」在哪裏? – willkara

+0

我的更新有幫助嗎? – Nacht

+0

heh更新了... – Nacht

相關問題