/    Sign up×
Community /Pin to ProfileBookmark

PHP Dynamic forms

Every tutorial I have read on php forms say to use the following type of code

[code=php]<input type=”text” name=”foo” value=”<?php echo $foo ?>” />[/code]

ASP has a more robust version:

[code=php]<asp:textbox name=”foo” value=”SomeField”></asp:textbox>[/code]

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?

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@bokehMar 11.2006 — 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?
Copy linkTweet thisAlerts:
@aaronbdavisauthorMar 12.2006 — 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.

[code=php]$f = new Form('myform');
$f->AddControl(new Textbox('foo', 'bar'));
print $f->__toString();[/code]

the above prints out this[code=html]<form id="myform">
<input type="textbox" name="foo" value="bar" />
</form>[/code]

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.
×

Success!

Help @aaronbdavis spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 4.30,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...