my python program is not executing at the server end and instead when i press the submit buttonthe browser is displaying the raw code of my python file.
I have kept my file in the path var/www/webgui.py.
I have installed apache web server.
please help on this.
Apache thinks your python file is a file to be served, and not a script to run. You need to configure apache to tell it how to treat the python files. There are a number of ways of doing this.
See here Configure Apache to use Python just like CGI PHP and http://docs.python.org/2/howto/webservers.html
Essentially you have to configure an extension that allows apache to run python scripts. mod_python and mod_wsgi are two examples (you only need one).