When you click the edit button, the web page sends a request to a php script to retrieve the edit panel for that particular message.
Here's the URL that the request is sent to.
What happens though when scripting is not available? You instead go along to this link, where the edit can also be performed.
It is that fundamental basis which underlies the technique that you want to achieve. Start with PHP scripting to perform the base actions that you wish to perform, and only once the you have those fundamental basics working do you use scripting to request the parts that you require from your working base.