Oli
Oli

Reputation: 239810

PHP form class

I'm used to ASPNET and Django's methods of doing forms: nice object-orientated handlers, where you can specify regexes for validation and do everything in a very simple way.

After months living happily without it, I've had to come back to PHP for a project and noticed that everything I used to do with PHP forms (manual output, manual validation, extreme pain) was utter rubbish.

Is there a nice, simple and free class that does form generation and validation like it should be done?

Clonefish has the right idea, but it's way off on the price tag.

Upvotes: 5

Views: 8277

Answers (7)

Chuck Le Butt
Chuck Le Butt

Reputation: 48758

Here's a new one that pretty capable. In a few versions I think it could be brilliant.

http://www.html-form-guide.com/php-form/php-form-validation.html

Upvotes: 0

David d C e Freitas
David d C e Freitas

Reputation: 7511

A very good form validator is in the CodeIgniter project:

Read the docs and tutorial for it in their great documentation:

Upvotes: 0

ajporterfield
ajporterfield

Reputation: 1019

I have recently used the project listed above - http://code.google.com/p/php-form-builder-class/ - in development and noticed that the latest release (version 1.0.3) replaces the table markup with a more flexible div layout that can be easily styled to render forms however you'd like. There are many examples that can help you get started quickly.

I would recommend this project.

Upvotes: 6

zlovelady
zlovelady

Reputation: 4097

Here's another free alternative:

http://code.google.com/p/php-form-builder-class/

It lets you create a form with code like:

include("../class.form.php5");

$form = new form("form_elements");

$form->addHidden("cmd", "submit");
$form->addTextbox("Textbox:", "field0");
$form->addTextarea("Textarea:", "field1");

$form->render();

Pros:

  • Built in form validation (PHP and javascript)
  • Comes out of the box with integrations with jQuery UI, CKEditor/TinyMCE, Google Maps, tool tips, etc.
  • Really easy to get up and running and creating powerful forms

Cons, which eventually kept me from using it:

  • No fine grain control of form output. You can either render the whole form as a table or nothing.
  • No fieldsets

It's looks to be under active development, so might be worth keeping an eye out for future versions/improvements.

Upvotes: 5

Oli
Oli

Reputation: 239810

The simplest solution (rather than going through the process of learning another framework) turned out to be just writing the forms and their processing code in Django and pulling their output into the PHP using CURL.

FILTHY but it was quick, has all the power of Django and it works.

Upvotes: 1

alex shishkin
alex shishkin

Reputation: 195

Symphony forms

Upvotes: 0

vartec
vartec

Reputation: 134551

Zend_Form

Upvotes: 3

Related Questions