Onclick function is not working when i use GET variable to pass data to another page using php

  get, javascript, php

Why is my onclick function is not working when i entered a page that has GET variable?

I have a simple onclick javascript function on my page button which is to show the custom modal i created, and it’s working fine unless i entered to a page i made that has GET variable such as:

http://mywebsite.com/page3.php?variable=45

Let me show you my simple onclick function if there’s an error.

function customeShow() {
  document.getElementById("cusModal").style.display = "block";
}
<button onclick="customShow()">Show Modal</button>

Those code is working fine if i’m only at the page that has not GET variable such as:

http://mywebsite.com/page2.php

I know i can fix this using SESSION for variable that need to pass data to another page, but i wanted ask some help here if there’s a possible way to make the onclick funtion work?

Source: Ask PHP

LEAVE A COMMENT