Yes, the Javascript is "embedded" into the PHP, quite correct. But so is HTML and CSS. And I wouldn't come here asking someone for help as to why my CSS is jacked. That argument is weak at best.
And if you don't realize where the lines between PHP/Javascript are I'd suggest some research before you start asking questions.
PHP Cannot "redirect" anything to another element on the page, its a serverside language, not clientside.
Javascript IS clientside and has far more capabilities than just being triggerd "on some goofy input button". I'd suggest a quick look on the old google and you'd probably be surprised at what you could find.