私は以下のスクリプトを使ってフォームに新しい行を自動的に追加しますが、$でPHPの各フィールドの値を取得する方法はわかりません_役職。 誰かがすでにフォームの表でこの問題を抱えている場合は、私を助けてくれてありがとう! test5.phpでフィールドの値を取得する手順は? 私は$ _POSTPHPで処理されたフォームの行を自動的に追加または削除する
に配列を取得する方法がわからないここで、事前
にありがとう私のスクリプトは
<html>
<head>
</head>
<body>
<form action="test5.php" method="post">
<div id="address">
<div id="1" name="address[]">
<input id="mail" type="text" />
<input id="type" type="text" />
<input id="comment" type="text" />
<a href="#" class="removeclass" style="display:none;">×</a>
</div>
</div>
<input id="add_address" type="button" value="Ajouter" />
<input type="submit" value="Create PDF" />
</form>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript">
$('#add_address').click(function(event) {
var lastDiv = $('#address > div').last();
var id = parseInt(lastDiv.attr("id")) + 1;
(lastDiv.clone(true).attr("id", id)).insertAfter(lastDiv).find(".removeclass").show();
return false;
});
$('body').on('click', '.removeclass', function(event) {
$(this).parent().remove();
return false;
})
</script>
</body>
</html>
まず、 1行しかありません。追加の行は、ユーザーが追加ボタン – Tony92
をクリックしたときにのみ表示されます。クリックするとそのブロックが追加され、「アドレス[] [mail]」などのパターンが使用されます。 –
Flocke