How do you put a JS code in PHP?

The easiest solution would be to put the script block after the form. Another solution would be to capture the window.onload event or use the jQuery library (overkill if you only have this one JavaScript). Lately I’ve come across yet another way of putting JS code inside PHP code. It involves Heredoc PHP syntax.
For More Information Please Refer:
You May Also Like to Read: