我想提交多个表单,所有表单外只有 1 个按钮。这是 index.php
<form id="allform" class = "NameInput" action="addToCartFood.php" method="POST">
Name: <input type="text" class = "inputName" name="Name" value=""><br>
</form>
<form id="allform" action="addToCartFood.php" method="POST">
Date:
<select name="Date" class = "Date">
<option value="26">26</option>
<option value="27">27</option>
<option value="28">28</option>
</select>
July 2020
</form>
<form id="allform" action="addToCartFood.php" method="POST">
Adult:
<select id = "selectboxAdult" name="Adult" class = "Adult" onchange = "calculateAll(<?php echo $_SESSION['price'];?>)">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
</form>
<input type="submit" class = "submitbtn" form="allform" value="Add to Cart">
当我单击按钮时,它将转到 addToCartFood.php,这些是代码
$_SESSION['Date'] = $_POST['Date'];
$_SESSION['Name'] = $_POST['Name'];
$_SESSION['AdultQ'] = $_POST['Adult'];
$_SESSION['KidsQ'] = $_POST['Kids'];
$_SESSION['telnum'] = $_POST['telnum'];
$_SESSION['comment'] = $_POST['comment'];
PIPIONE