I am trying to send the text typed in to a box via a link. Please see my code below. It isn't sending through for some reason?
<script>
var discountCode = document.getElementById("discountCode").value;
openPage = function() {
location.href = "payment.php?discount="+discountCode;
}
</script>
<a href ="javascript:openPage()" class="btn btn-warning">Purchase</a>