It's fairly easy to do and yet SO useful. When working with forms, I like to use arrays for all my fields. All data retrieved in the form is put into a values array. A parameters array informs the form's action what to do with that values array.
Observe the following. It's purpose is to submit an email (although that code is not shown here):
<form action="email.php">
<input name="parameters[mode]" value="send" type="hidden">
<input name="parameters[redirect]" value="http://www.foobar.com" type="hidden">
<input name="values[subject]">
<textarea name="values[body]"></textarea>
</form>
It's a simple enough form, but makes it easier to handle in the form's action. PHP and other server side languages champion great array functions that make your life easier through organization, data manipulation, verifying, validation, and other neat little tricks. Try it out and see exactly how useful it can be.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment