I want to send data from a form to other php page. Instead of a button in the form I have a button outside to submit. How can I send the data from the form to the other page? Here is the code:
<div class="body">
<form id="productform" class="form-style-12" action="" method="post">
<ul name="products">
<!-- products added to the cart will be inserted here using JavaScript -->
</ul>
</form>
</div>
<footer>
<a href="checkout.php" id="checkoutbtn" class="checkout btn"><em>Ga verder: €<span>0</span></em></a>
</footer>
The < ul > get filled by products using javascript.
答案 0 :(得分:0)
一个简洁的解决方案是在表单和样式中创建一个。
但你可以在问的时候解决它:
<a href="" onclick="document.getElementById('productForm').submit()">Submit!</a>
答案 1 :(得分:0)
您可以使用此
function submitFormData() {
document.getElementById("yourformid").submit();
}
&#13;
<button onclick="submitFormdata();">Submit</button>
&#13;