| ★ wanayoo — archive 1999 http://phpbuilder.com/columns/quickie19990502.php3 | Nouvelle recherche | Portail wanayoo |
|
|
|||
|
|
|
|
||
|
|
|
Automatic form and variables generatorby Didier Legein - didierlegein%40mosaic.xs4all.beI came to this little article by looking for a solution for following problem; I have several database tables which consisted of more than 25 fields/columns. before I handcoded all this in html, but with such an important number of fields, I gathered it should be possible to automate this task; First I created an "all purpose" general connection script to the mysql backend:
<?php
Then I decided to wrap the HTML <INPUT> tags from the <FORM> into a <TABLE> and take as field identifiers the respective column name of the database table:
<?php
For reasons of logic each NAME of the <INPUT> tag is given the same name as the individual fields of the database table.
This will make it easier for us afterwords to construct the general
"insert.php3 script" that is invoked by
Well, now we have found an easy way of generating a simple input form,
especially handy for large database tables.
If we now have to handcode all the HTTP_POST_VARS in the insert script,
this would give us quite some work as well (and yes, I'm kind of lazy ..;-))
So following script will generate the variables automatically and
correctly for the INSERT query :
<?php
I hope someone can use these scripts for his or her setup, it works for me ...
(I also especially would like to thank Chad Cunningham for his help on creating
the insert.php3 script (especially the automatic creation of the posted variables array)
|
||
|
|
|
Sample Code | Columns | Mail Archive | Support | Get Started! | Links | Contribute!
Contact (non support questions) By viewing these pages you agree to the Legal Terms of Service.
Geocrawler.com | GoToCity.com | DirectriCity.com | PHPBuilder.com | The Des Moines City.net |