I know there is one answer out on stackoverflow, but that is related to form submission.
Mine is different implementation. I need to call a function, which registers a variable in $_SESSION[], and then redirects to another page(html/php).
Now I don’t want to use AJAX. Please help me with this.
That is not possible. Php is executed on the server before the html is served. All php functions have been evaluated to HTML at the time onClick occurs.
You can do a form and set action=”someFile.php” and use $_GET[‘someVaiable’] or $_POST[‘someVariable’]