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 **在我上面的评论... –