我有兩個PHP頁面。一個控制窗體,另一個顯示一個表格。我的問題是,我在決定問題數量的形式中有微調,當用戶提交時,無論顯示在微調器上的數字是多少,都應該在表格中顯示相同數量的行。我想顯示'n'行數,取決於在微調中選擇的數字
例如,如果Spinner = 25,那麼它應該在表格中顯示25行,並在問題Id(<td class="qid">
)的行1,2,3,4 ...最多爲25。
我知道這將使用if語句,循環和$_POST
方法,但我不知道如何對其進行編碼。有人知道嗎?我不知道是否應該在php或JavaScript中完成,因爲javascript會打開與表格的新窗口並控制微調器。
下面是微調代碼並提交按鈕(create_session.php)
<form action="create_session.php">
<th>Number of Questions:</th>
<td class="spinner"><textarea class="spinnerQuestion" id="txtQuestion" cols="2" rows="1"></textarea></td>
<td><button class="scrollBtn" id="btnQuestionUp" type="button"><img src="Images/black_uppointing_triangle.png" alt="Increase" /></button>
<button class="scrollBtn" id="btnQuestionDown" type="button"><img src="Images/black_downpointing_triangle.png" alt="Decrease" /></button></td>
</tr>
</table>
<div id="numberAlert"></div>
<p><input class="questionBtn" type="button" value="Prepare Questions" name="prequestion" onClick="myClickHandler()"/></p> <!-- Prepare Questions here-->
</form>
下面是表代碼(QandATable.php)
<table border=1 id="qandatbl" align:center;>
<tr>
<th class="col1">Question No</th>
<th class="col2">Option Type</th>
<th class="col1">Duration</th>
<th class="col2">Weight(%)</th>
<th class="col1">Answer</th>
<th class="col2">Video</th>
<th class="col1">Audio</th>
<th class="col2">Image</th>
</tr>
<tr>
<td class="qid"></td>
<td class="options"></td>
<td class="duration"></td>
<td class="weight"></td>
<td class="answer"></td>
<td class="video"></td>
<td class="audio"></td>
<td class="image"></td>
</tr>
</table>
對我來說,看起來你好像在想什麼。這是非常基本的東西。你應該在你的項目上休息一下,以瞭解更多關於PHP,HTML等的知識,然後回到它。 – Ariel
你的權利,我真的是甲骨文和SQL程序員,但被迫包括PHP和JavaScript編程,以獲得功能的工作,沒有其他人這樣做,但我:( – BruceyBandit
如果您有任何其他編程經驗,我敢打賭,你可以學習足夠的PHP在短短几天內就可以完成 - 這不是一門難懂的語言。 – Ariel