473,385 Members | 1,347 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

form definitions in mysql

I just took over a web site that implements input forms in a clever way: all
form definitions are centrally managed in a mysql table. For example, when a
page needs to build an input form that asks for name, ssn, dob, etc, it gets all
of the rows in the form table that has a form id of (n). Each of these rows has
the field size, display order, caption, post name, etc. for the name, ssn, dob,
etc inputs. There is also a function column that can call a php function for the
field display info (e.g., if a field is a pick list that is populated by a
select.) There are some obvious advantages of managing forms in this manner,
since if one needs to hide a field, lengthen it, change the caption, change the
order, add a field, or whatever, one modifies the forms table and not the web
page(s).

Perhaps this is not an uncommon technique, but I haven't come across it before.
Has anyone seen this methodology described, either in print or on the web?

Thanks -

zach
May 1 '06 #1
2 1032
zach wrote:
Perhaps this is not an uncommon technique, but I haven't come across it
before. Has anyone seen this methodology described, either in print or on
the web?


Yes, I am currently writing (for fun) an form library for me. The code is
used like so:

$contact = new form;
$pd = $contact->add_section('Personal Details');
$pd->add_text('First Name')->add_rule('max-len', 100);

It's pretty neat, but still unstable.

Carl

--
Carl Vondrick
Web-Enginner
www.CarlSoft.net
To contact me, please use my website.
May 1 '06 #2
This is definitely a way to do the things quickly and with less code.

However, I, personally, would suggest not to directly map against
database tables.

If so, do some encoding on it. The reason is obvious. If you are not
checking against the actual fields in the database, SQL-Injection may
be possible by custom-data creation.

What if I hand-craft the data and send it. If you blindly execute the
SQL against the names / values from the forms... things may be
problematic.

Can't give an example for keys being SQL-injected... but I think that
should very much be possible.
--
Cheers,
Gaurav Vaish
http://mastergaurav.org
---------------------------

May 1 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Marcel | last post by:
Hello all, I am working on a generic (php) script to produce (X)HTML Forms through XML and XSL based on field-definitions stored in a database. The basic way i did HTML-forms in PHP was like...
2
by: PinkBishop | last post by:
Hello All, Hope you can help. Below is the code I use to send data from form to database. Problem is if an apostrophe is entered in cQuestion field or any field for that matter the form...
4
by: Lee David | last post by:
How do I take a field from a form and store it on in a mySQL table? TIA, Lee
25
by: Lyn | last post by:
Hi, I am working on a genealogy form. The only table (so far) lists everybody in the family, one record per person. Each record has an autonum ID. The parent form (frmMainForm) displays the...
0
by: Frnak McKenney | last post by:
I'm running into problems with VisualStudio.NET2003 and Windows Forms inheritance. It _feels_ like a bug, but it could just as well be a misunderstanding on my part regarding how the VS Designer...
6
by: Mark | last post by:
Hello. I have an MS Access 2000 form whose fields I need to read and write from VBA. The fields are data-bound, using a query that has been defined and saved in my Access database. The query...
1
by: tomlebold | last post by:
Having problems displaying query results from combo boxes on a sub form, which is on the same form that is used to select criteria. This has always worked form me when displaying query results on...
4
by: Cigar2011 | last post by:
I will try to be short and to the point.(good Luck) I have a form written in HTML. I have a Mysql database. I am using a linux server and I would like to use php to write the following code: ...
8
by: NMarks | last post by:
Hello all, I have created a database for my work that stores information for keys/locks, doors and employees. Specifically the database contains all the information of our lock system, which...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.