|
|
Daniel P. Lamblin's Homepage |
|
|
|
|
PHP is the Perl of html writers. Well, not that perl isn't mainly the
perl of html folk. I've been writing a bit of php recently.
I bet you figured there's some php used here to
form a template. Its not the most sophisticated thing, but try
accessing only a
partial page.
Foiled, eh? Why would I bother putting that in there? Well its because
of more of my php at
www.syntaxerr.org,
specifically the
whatsnews.php
script that might link to a partial page when doing its thing.
See its
source
after you tried the other link.
phpform.php( View File ) ( Download File ) ( Try it )This was written as a quick example to a friend as to how php can validate forms without javascript. In addition it demonstrates how a hidden input attribute can inform php whether or not the form has been filled out yet. All in all this is not that impressive. Of course, as an aid to someone writing a similar php page, it had to be kept simple and short, to be easy to understand and build on. A possible extension would be to have errors not be concatinated and displayed all in one area, but rather to be displayed next to the item where the error occured. This could be accomplished by using multiple error variables in the form, or by using an associative array to the same ends.
|
||
|
|
Copyright ©2002-2004 Daniel Pascal Lamblin | ||