<a href="clientarea.php?action=productdetails&id={$serviceid}" class="btn btn-success">&laquo; Back to Proxy List</a>
<br /><br />
<div class="alert alert-warning">This page redirects you to the cart to complete the order.</div>

Months: <input type="number" min="1" max="12" name="months" id="proxy-months" value="1">
<br /><br />
<buttton type="button" class="btn btn-block btn-success" onclick="save()">Save</button>
{literal}
<script>

function save()
{
const months = document.getElementById('proxy-months').value;
  fetch(window.location.href+'&act=save', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({ months })
  })
  .then(response => {
  	window.location.href = 'cart.php?a=view'
  })
  .catch(error => {
    // obsługa błędu
    console.error(error);
  });
}

</script>
<style>
</style>
{/literal}