There are already answers to this question (Adding POST parameters before submit) but I personally think that adding dom elements should not be the way to go.
My approach would be to get the form data onsubmit and add your objects to it. Afterwards send the request. The major benefits are you can make use of ajax (which in fact improves the user experience) and dont have to modify / add dom elements which can get quite nasty if you add more than 2 objects.
var items1 = {
name: "test1",
value: "123"
} //needs to submit with form
var items2 = {
name: "test2",
value: "456"
} //meeds to submit with form
$("#orderform").submit(function(event) {
event.preventDefault();
//add the items to the form data
let data = $(this).serializeArray();
data.push(items1);
data.push(items2);
let params = $.param(data);
//send the data with ajax
$.ajax({
type: $(this).attr('method'),
url: $(this).attr('action'),
data: data,
success: function(data) {
window.location.href = "success.php"+params;
},
error: function() {
}
});
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<form role="form" id="orderform" action="test.php" method="post">
<input type="text" name="test">
<button type="submit">Place Order</button>
</form>
In order to show the results on a seperate page I'd add the form data as get parameters to the success redirect and show them like this.
Please also read on XSS and how to avoid it (sanitize input / parameters).
success.php should look like the following.
echo $_GET["test1"];
echo $_GET["test2"];