我已經爲用戶設置了一個PHP表單,用於輸入所有要存儲在數據庫中的信息。我使用了NetTut +教程來做到這一點。如何在提交到數據庫之前將PHP表單分成兩部分?
我已經把表格提交到數據庫中,但有很多額外的問題,我想將表單分成兩個單獨的部分。很明顯,第一頁會說在第二步之前繼續下一步,允許將表單提交給數據庫。
用戶看到的內容應該被拆分,但應該都是同一表單的一部分。提交之前的步驟1>步驟2。
有人會知道或推薦任何方法來做到這一點嗎?
我附上了下面的代碼。
<form method="post" action="">
<fieldset>
<ul>
<li>
<label for="code">Entry Code On-Pack</label>
<input type="text" name="code" />
</li>
<li>
<label for="name">Name</label>
<input type="text" name="name" />
</li>
<li>
<label for="email">Email</label>
<input type="text" name="email" />
</li>
<li>
<label for="addressone">Address</label>
<input type="text" name="addressone" />
</li>
<li>
<label for="addressone"> </label>
<input type="text" name="addresstwo" />
</li>
<li>
<label for="addressone"> </label>
<input type="text" name="addressthree" />
</li>
<li>
<label for="telephone">Telephone</label>
<input type="text" name="telephone" />
</li>
<li>
<label for="dob">Date of Birth</label>
<input name="dob" type="text" value="[dd/mm/yy]" />
</li>
<li>
<label for="q1">Where have you seen Cookstown advertised?</label><br />
<input type="checkbox" name="q1cb1" /><label for="q1cb1">Magazines</label><br />
<input type="checkbox" name="q1cb2" /><label for="q1cb2">Billboards</label><br />
<input type="checkbox" name="q1cb3" /><label for="q1cb3">Television</label><br />
<input type="checkbox" name="q1cb4" /><label for="q1cb4">Radio</label><br />
<input type="checkbox" name="q1cb5" /><label for="q1cb5">Online</label><br />
<input type="checkbox" name="q1cb6" /><label for="q1cb6">Public Transport</label><br />
<input type="checkbox" name="q1cb7" /><label for="q1cb7">Bus Stops</label><br />
</li>
<li>
<label for="q2">How well do you remember those advertisments?</label><br />
<input type="radio" name="q2" value="VeryWell"/><label for="q1cb1">Very well</label><br />
<input type="radio" name="q2" value="FairlyWell"/><label for="q1cb2">Fairly well</label><br />
<input type="radio" name="q2" value="FewDetails"/><label for="q1cb3">A few details</label><br />
<input type="radio" name="q2" value="NotAtAll"/><label for="q1cb4">Not at all</label><br />
</li>
<label for="tc">Do you accept the terms and conditions</label>
<input type="checkbox" name="tc" class="styled" />
</li>
<li> </li>
<li>
<input type="submit" value="Enter Competition" class="large blue button" name="signup" />
</li>
</ul>
</fieldset>
</form>
嗨Surugman, 你能夠告訴我更多關於這種方法。這正是我想要做的,但似乎無法找到一種方法或教程來幫助我這樣做。 我目前有一個窗體,裏面有列表項以及其中的字段和其他輸入類型。我將如何將這些隱藏區域放置在一個按鈕中以擴大其一半並隱藏另一半? 非常感謝您的幫助,提前。 :) – 2010-03-19 17:59:20
如果您正在使用兩個部分使用單一表單的路線,表單中的兩個單獨的字段集(帶有合適的圖例)比div更合適。 – akamike 2010-03-19 18:06:17