我是php的新手,请告诉我,按钮点击事件应该通过php向现有表单添加新的输入标签


I am new to php ,please tell me ,button click event should add new input tag to existing form through php

$('#b1').click(function() {
                $('.frm1').append('<label for="part">Part Name</label><input type="text" name="part" class="lsize"><br><br>');
    });
}); 

在我看来,解决问题的最简单方法是使用javascript或像jquery这样的框架。

$('button').click(function() {
    $('form').append('<input type="text" ... />');
});

你可以试试这段代码,但我宁愿使用javascript。

您的文件(带结尾.php!

<form name="addpart" action="<?php echo $_SERVER["PHP_SELF"]; ?>"  method="POST" class="frm1">
            <label for="part">Part Name</label>
            <input type="text" name="part" class="lsize"><br><br>
            <button name="b1" type="submit">Add</button>
<?php
if(isset($_POST["b1"])) {
echo('<input type="button">'); // Your HTML input code
}
?>
</form>