2011-08-13 24 views
0

GET獲得更多的一個元素。如果我有這樣的代碼:PHP由一個輸入

<input type="hidden" name="hello" value="hey" /> 
<input type="text" name="one" /> 

我會寫一些東西,例如: 「哎」,它會顯示:

域。 com/index.php?hello = hey & one = hey

但是,我想從特定輸入中獲取更多元素。例如:

這是我的全碼: 爲電子

<input type="hidden" name="hello" value="hey" /> 
<input type="text" name="one" /> 
<input type="text" name="two" /> 

如果我寫的 「一個」,它會顯示: domain.com/index.php?hello=hey &元素= sometext &一個= sometext
如果我寫一篇關於 「兩節」,它會顯示:domain.com/index.php?hello=hey & another_element = sometext & 2 = sometext

我該怎麼做?

對不起,我的英語。

+0

,如果你在這兩個寫會發生什麼? –

回答

1

只需使用 「GET」 方法:

<form method="get"> 
    <input type="hidden" name="hello" value="hey" /> 
    <input type="text" name="one" value="1" /> 
    <input type="text" name="two" value="2" /> 
</form> 

它將創建查詢字符串?hello=hey&one=1&two=2

+0

它不符合我的要求,我想用一個輸入來做這件事。 – Daniel

+0

這是一個問題,如果他們都出現在查詢字符串?如果「one」是空的,「two」的值是「2」,那麼它會給你'?one =&two = 2',這不是問題,或者我不明白爲什麼。 – Dalmas

+0

因此,也許我會使用多個

標籤? – Daniel