当表单提交后,我该如何将这个id
传递给PHP变量?我需要将总值传递给PHP变量。请帮助我解决这个问题。
<div class="table-responsive">
<table class="table table-bordered">
<tr>
<th>Total Price</th>
</tr>
<tr>
<td>
<input class="form-control1" type='text' id='txt_totalprice' name='txt_totalprice[]'/>
</td>
</tr>
</table>
</div>
Total: <div id="totalvalue">0</div>
以下是脚本内容:
<script type='text/javascript'>
$('#totalvalue').click(function() {
$.post("package.php", {
id: $(this).attr('id')
}, function(response) {
alert(response);
});
});
</script>
package.php
页面中使用$_POST['id']
即可。 - Rory McCrossan