in PHP by
Q:
How to Run a PHP code after button click but without refreshing page?

1 Answer

0 votes
by

You need to use either the onsubmit event of the form or the onclick event of the button.

In the event handler, you assemble a URL and "get" it. For example:

<script type="text/JavaScript">

function submitCouponCode()
{
    var textbox = document.getElementById("couponCode");
    var url =
        "https://www.example.com/script.php?couponCode=" + encodeURIComponent(textbox<span style="border:0px; box-sizing:inherit; color:var(--black-750); font-family:inherit; font-stretch:inherit; font-style:inherit; font-variant:inherit; font-weight:inherit; line-height:inherit; margin:0px; padding:0px; vertical-align:b
Click here to read more about Loan/Mortgage
Click here to read more about Insurance

Related questions

0 votes
asked Jun 22, 2019 in PHP by SakshiSharma
0 votes
asked Jun 23, 2019 in PHP by SakshiSharma
0 votes
asked Jun 23, 2019 in PHP by SakshiSharma
0 votes
asked Jun 22, 2019 in PHP by SakshiSharma
0 votes
asked Jun 4, 2020 in PHP by Robindeniel
0 votes
asked Mar 19, 2020 in PHP by DavidAnderson
...