I have a web age containing both PHP(7.3) which is first in the file and HTML(5) shown below.
In the PHP, I do the following:
echo '<script>gotoLogIn();</script>';
In the HTML, I have the following:
<script>
function gotoLogIn() {
alert("Now going elsewhere.");
window.location.replace("http://localhost/xxxx/yyyy/zzzz/index.php");
}
</script>
When the PHP "echo" is executed, I get "Uncaught ReferenceError: gotoLogIn is not defined which shows up on the Firefox Web Console". I get the same error on Chrome.
I've tried a number of things including the answer to a similar question on SO with no joy.
I am at a loss. This is the technique I have found in several sites.
Are they old references and is there a newer way to do this or a security action that needs to be taken.
All help appreciated.
Regards, Jim