You can't do that.
Oh, you can, but that means you have to submit the <form> back to the server and have your PHP code *COMPLETELY REWRITE THE ENTIRE PAGE*.
You don't seem to understand the basic nature of web programming and how the server and client (usually browser) interact. PHP is entirely INAPPROPRIATE for this usage.
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.