0
我有一個可以創建字段的表單,但是如何從創建的表單中刪除添加的字段?甚至刪除特定的字段?對不起,我有點新鮮。 如果可能的話,有沒有辦法刪除只有一行的我添加了旁邊的十字按鈕或什麼的?以php格式刪除特定的添加字段
形式
<script type="text/javascript">
function addTextArea(){
var div = document.getElementById('name');
div.innerHTML += "<input type='text' name='name[]' value='' />";
div.innerHTML += "\n<br />";
var div = document.getElementById('quantity');
div.innerHTML += "<input type='text' name='quantity[]' value ='' />";
div.innerHTML += "\n<br />";
var div = document.getElementById('amount');
div.innerHTML += "<input type='text' name='amount[]' value =''/>";
div.innerHTML += "\n<br />";
}
</script>
</head>
<body>
<form method="POST" action="confirm_invoice.php" >
<?php
echo "<table border='2'>\n";
echo "<tr>\n";
echo "<th>Description</th>\n";
echo "<th>Quantity</th>\n";
echo "<th>Amount($)</th>\n";
echo "</tr>";
echo "<tr>";
echo "<td>"?><input type='text' size="50" name='name[]' value='Examination and Consultation' readonly/><?php "</td>";
echo "<td>"?><input type='text' size="50" name='quantity[]' value='' /><?php "</td>";
echo "<td>"?><input type='text' size="50" name='amount[]' value='' /><?php "</td>";
echo "</tr>";
echo "<tr>";
echo "<td>"?><div id="name"></div> <?php "</td>";
echo "<td>"?><div id="quantity"></div> <?php "</td>";
echo "<td>"?><div id="amount"></div> <?php "</td>";
echo "</tr>";
?>
<br />
<input type="button" value="Add Description" onClick="addTextArea();">
<input type="submit" name="submit" value="submit">
</form>
</body>
</html>
你閱讀了有關PHP手冊基礎知識[串](http://us1.php.net/manual/en/language.types.string.php)以及如何[逃生](HTTP:/ /us1.php.net/manual/en/language.basic-syntax.phpmode.php)進出PHP代碼塊?你可能想檢查出來,因爲你的PHP是錯誤的。這應該先解決。 –
呃不,我還沒有。我在哪裏閱讀? – user3098046
我*鏈接到** BOTH **在我上面的評論... –