PHP Form Development Best Practices

Posted on 2009-04-21
Last Modified: 2013-12-12
I'm looking for advice on Best Practices in form design for PHP. Do most people hand code each form that they build to interact with their database?

I have written my own object code to handle the display of the form, the CRUD and the validation. I am currently considering extending the functionality so that the parameters for each form and each control are stored in a database - and I'm wondering if that's normal, or if there is a better way to do it. Would it be advisable to use a framework?

My motivation is that I want administrators of my webapp to be able to choose an "Edit this list" option from any <select> which will pop up a modal form of the table for that <select> so that they can make additions/deletions and changes and I feel that the best way to manage that is by having the form created at runtime by pulling the parameters for the form from the database.


P.S. I expect that I will split points if I receive good advice from multiple experts :-)
Question by:dirknibleck
    1 Comment
    LVL 12

    Accepted Solution

    Seeing as PHPCake already performs dynamic form generation, customized validation and has a very solid CRUD design, perhaps this would be the best place for you to consider working out of.

    There's nothing wrong with reinventing the wheel if doing so will yield a better performing wheel or you have found a way to make a square wheel not as rough of a ride, but overall, the PHPCake framework was developed by people that write this sort of code in their sleep and has a proven track record.

    Hope this helped a little. :)


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Free Trending Threat Insights Every Day

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Suggested Solutions

    Title # Comments Views Activity
    True Type Font Files? 4 46
    Site thumbnails shows up as facebook 10 43
    code igniter select query 7 21
    Php Sql Query 7 19
    Both Easy and Powerful How easy is PHP? (  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikiped…
    Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
    Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
    The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    9 Experts available now in Live!

    Get 1:1 Help Now