Menu

#5 Good Idea for adding fields

open
nobody
None
5
2001-08-13
2001-08-13
No

I just came up with a great idea for being able to add
as many fields as you like.

first of all, since this is an abstract class, it
needs to be able to do pretty much anything... so
here;'s what i came up with:

instead of: name,age,sex,school,etc...
change to: authfields[];

like this:
you let the user make a hidden input called authfields
that contains comma delimited of all the fields...

then you also let the user make a "validate()"
function, and pass it as a reference.. for starters
make a sample one..

then

$authfields = explode(",",$authfields);
while( list( $key, $val ) = each($authfields) )
{
// validate...
if( !validate( $key, $val ) )
{
return 0;
}
}

[...]

and for the db, use that loop to build a string for
the db manupilation and so on...

NOTE: this would requuire rewriting most of the class.

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.