Dalke Scientific Software: More science. Less time. Products

Search for "HTML forms tutorial" and you'll find many pages. In looking through them the one I liked best was here. I'll walk through it.

I wrote a simple CherryPy application which accepts a couple of form queries. You can use it when testing your forms. Download cherrypy_echo.py and run it from the command-line. This will start a web server on port 8080 of your machine. You can also use "http://192.168.4.40:8080/" which is my laptop.

Enter your name:

<form method="POST" action="http://localhost:8080/hello" style="background-color: yellow">
Enter your name:
<input name="username">
<input type="submit" VALUE="Test this form">
</form>

(What's "style="? It's part of CSS.)

You could also link to it as a GET: http://localhost:8080/hello?username=Andrew.


The server implements the method "/add" which takes the parameters "a" and "b", both integers. Make a form which asks for the two numbers and goes to that page.


Comments and feedback welcome



I found out about this page...

Email address:
<form method="POST" action="http://localhost:8080/" style="background-color: yellow">
<br><textarea name="feedback" ROWS=20 COLS=60></textarea>
<br>I found out about this page...
<br><textarea name="heard" ROWS=2 COLS=60></textarea>
<br>Email address:
<br><textarea name="username" ROWS=1 COLS=20></textarea>
<input type="submit" VALUE="Send feedback">
</form>

(Note: for a 1 line textarea; use the regular 'input' element.)



Baseball
Basketball
Football
Hockey
Soccer

<form method="POST" action="http://localhost:8080/" style="background-color: yellow">
<br><input type=checkbox name="baseball" value="Y">Baseball
<br><input type=checkbox name="basketball" value="Y">Basketball
<br><input type=checkbox name="football" value="Y">Football
<br><input type=checkbox name="hockey" value="Y">Hockey
<br><input type=checkbox name="soccer" value="Y">Soccer
<br>
<input type="submit" VALUE="test it">
</form>

Experiment!



Copyright © 2001-2020 Andrew Dalke Scientific AB