Unless I misunderstand your question, I don't think you can do what you are attempting. In any browser known to me, when you submit a form by clicking a submit button, the browser will automatically fetch a new page. The content of the newly displayed page will consist of whatever the CGI form handler returns, which, as the CGI programmer, can be anything you want.
I will hazard a guess that you are really asking how to exchange data between the browser and server without causing the page to be re-drawn. As I understand it, the usual solution to this is through AJAX mechanisms. It is probably beyond the scope of one LQ thread to fully describe how to accomplish that, but there is plenty of online documentation that explains the process. The Wikipedia AJAX page
is probably a good jumping off point.