In some cases, we may need to pass data from an input field or template file to the PHP controller.
There are different methods like form submission and calling the field by $_GET or $_POST functions
here we used the real-time scheme to pass value directly through PHP
This can be achieved using the following code,
<script>
function myCutsheetdownload() {
var discount = document.getElementById("discount-input").value;
window.location = "<?= $this->getUrl('cutsheet/download/pdf', ['id' => base64_encode($cdu_product_id)]); ?>"+'discount/'+discount;
}
</script>
here discount is the input field and the value is set to a variable and passed to the PHP controller.
Like: “+’discount/’+discount