<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>
Bandwidth (GB): <input type="number" min="1" max="10000" name="bw" id="proxy-bw" value="1">
<br /><br />
<buttton type="button" class="btn btn-block btn-success" onclick="save()">Save</button>
{literal}
<script>

function save()
{
const bandwidth = document.getElementById('proxy-bw').value;

if(bandwidth < 1 || bandwidth > 10000){ alert('Bandwidth value is too high'); return; }
  fetch(window.location.href+'&act=save', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({ bandwidth })
  })
  .then(response => {
  	window.location.href = 'cart.php?a=view'
  })
  .catch(error => {
    // obsługa błędu
    console.error(error);
  });
}

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