First of all, please see my comment to the question.
The element
<form>
makes little sense without the attributes
action
and
method
. (You show such thing in your code fragment below horizontal line.) It would be just rendered as a block element (or with different display properties, depending on your styles), no different from regular
div
. A form makes sense only if you really need to send some HTTP request to the server side, where PHP can process it. It's not clear what would you mean by "external" file. The URI used in your request sent via the Submit button is defined as the value of your
action
attribute, it could be some PHP file; the special case is when it is the same file as the file of your form, because usually you want to display the same form after postback and getting a refreshed page of the page. If this is the case (it's not clear from your question), you, basically, need to render whole HTML text via PHP echo, so you would get back to the same page with the same form, plus the result of handling the data sent in your form. If this is what you wanted to achieve and still have some question on this option, please clarify. Anyway, no matter what PHP you want to use and what is "external" and what is not,
this is your first option.
Another option is not using PHP at all for your "echo". For this purpose, you don't need a form at all. You can have a regular button and add a
click
handler to it in JavaScript. The handler function can read any of your data from your control, handle it and add processed data in the form of any HTML added to your existing HTML DOM (or replacing part of existing content). This is pretty easy, but you may want to ask additional question if you have concern on some detail.
Finally, you could use compound approach which also does not require a form. If you still need some processing on server side, with PHP, you can send some arbitrary HTTP request and receive response using Ajax. You have to collect data from input control and send the request explicitly using JavaScript; the HTTP response is also handler with JavaScript. The benefit of this approach, in comparison with forms, is that
you don't have to reload the whole page, instead, you just modify the HTML DOM on the part of the page, only in part relevant to the data received from HTTP response. This way, you can greatly, improve responsiveness of your application, reduce the use of network traffic, eliminate or reduce visual flicker, and so on. Please see:
Ajax (programming) — Wikipedia, the free encyclopedia[
^].
—SA