Click to See Complete Forum and Search --> : PHP Dynamic forms


aaronbdavis
03-10-2006, 03:59 PM
Every tutorial I have read on php forms say to use the following type of code <input type="text" name="foo" value="<?php echo $foo ?>" />
ASP has a more robust version:<asp:textbox name="foo" value="SomeField"></asp:textbox>
is there a PEAR extension which handles forms like this, or at least in a more intuitive manner?

if not, what methods have you used for form processing?

bokeh
03-10-2006, 07:18 PM
Whats this got to do with form processing? All you are doing is echoing a variable why would you need a PEAR class to handle that?

aaronbdavis
03-12-2006, 11:14 AM
I am trying to find a way to make form processing more intuitive. To this end I have been working on a series of classes for handling forms.
$f = new Form('myform');
$f->AddControl(new Textbox('foo', 'bar'));
print $f->__toString();
the above prints out this<form id="myform">
<input type="textbox" name="foo" value="bar" />
</form>
when the user submits the form, the new value is displayed.
I am planning to add a Process() function which would attempt to validate the form, and based on the input would either return errors for the user to correct, or process the data.

I had also planned to add some secutiry features, such as encrypting the input's name based on the timestamp of the start of the request, making each incarnation of the form appear with different variable names, and therefore be more difficult to hack. I was also going to add a security token to the form, based on the same timestamp idea, which would disallow processing a form from a different site.

Due to limited time to devote to developing this idea, I thought it pertinent to ask if there was anything that already does this.