javascript变量变成php形式

I can now display the total price of a javascript var on the page. But I also want to send this value with the form once it is submitted. Is there any way to do this? (Everything is embedded in a normal form)

<div id="totalPrice"></div>

script

var Price = getstatus() + getroom() * getdays()

//display the result
var divobj = document.getElementById('totalPrice');
divobj.style.display='block';
divobj.innerHTML = "The total cost is €"+Price;

Add a hidden number input inside of the form so the data will be passed onto the server:

<input type='hidden' id='totalCost' />

Then put in the total cost:

var totalCost = document.getElementById('totalCost');
totalCost.innerHTML = Price;

Then submit the form:

totalCost.form.submit();