你好我有这个代码。
<script type="text/javascript">
(function($){
$countForms = 1;
$('.myForms').submit(function () {
console.log("");
return true;
});
$(function(){
$("#clickMe").bind("click", function(){
$(".myForms").trigger('submit');
});
});
$.fn.addForms = function(){
var myform =
"<fieldset>"+
"<form action='' method='POST' enctype='multipart/form-data' class='myForms'>"+
"<label class='label_ga' for='artikel("+$countForms+")'>Omschrijving gewenst artikel:"+
"<input class='input_ga' name='artikel["+$countForms+"]' type='text' value='' size='30'></label><br>"+
"<label class='label_be' for='bewerking("+$countForms+")'>Omschrijving gewenste bewerking:"+
"<input class='input_be' name='bewerking["+$countForms+"]' type='text' value='' size='30'></label><br>"+
"<label class='label_aa' for='aantal("+$countForms+")'>Aantal:"+
"<input class='input_aa' name='aantal["+$countForms+"]' type='text' value='' size='30'></label><br>"+
"<label class='label_kl' for='kleur("+$countForms+")'>Kleur:"+
"<input class='input_kl' name='kleur["+$countForms+"]' type='color' value='' size='30'></label><br>"+
"<label class='label_op' for='opdruk("+$countForms+")'>soort opdruk:"+
"<select class='select_op' name='opdruk["+$countForms+"]' size=''30>"+
"<option>borduren</option>"+
"<option>bedrukken</option>"+
"<option>voorzien van eigen logo of uitdruking</option>"+
"</select></label><br>"+
"<label class='label_fi' for='file("+$countForms+")'>Afbeelding:"+
"<input class='input_fi' type='file["+$countForms+"]' name='foto' value='' size='30'/></label>"+
"</form>"+
"</fieldset>";
myform = $(myform);
$("button", $(myform)).click(function(){ $(this).parent().parent().remove(); });
$(this).append(myform);
$countForms++;
};
})(jQuery);
$(function(){
$("#mybutton").bind("click", function(){
$("#container").addForms();
});
});
</script>
</head>
<body>
<div id="container">
<button id="clickMe">send</button>
</div>
<button id="mybutton">Artikel Toevoegen</button>
<input id="mybutton" type="button" value="Artikel Toevoegen" name="add"/>
</body>
</html>
<?php
//if (isset($_POST['submit'])) {
$count = count($_POST['artikel']);
echo $count;
foreach ($_POST["artikel"] as $artikel) {
// echo $artikel;
print_r($_POST["artikel"]);
}
//}
?>
这是一个简短的测试脚本。
有人可以帮助我,告诉我如何制作一个提交表格的按钮。 来自表单的信息最终可以通过php代码访问,所以我可以通过邮件发送它(我已经有了一个表单的代码)
希望有人能帮助我,谢谢