form.html:
<form action="p.py" method="post">
<input type="text" id="id_text" name="name_text" />
<input type="submit" id="id_submit" name="name_submit" />
</form>
p.py:
#!/usr/bin/python
#what to write here...
Both files are put in /var/www/ , now from http://example.com/form.html, if I click the submit button would I execute the p.py and how can I get the value of textbox?
It’s apache/httpd webserver installed on computer.
1st, to make
p.pyrun by apache, you need to check:p.pyfile is runable, modify bychown/chmod2nd, to get the value from a form, you need to understand cgi knowleges and get data from environment,
or much easier by using cgi module:
at last, I suggest:
/var/www/