Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

PHP records page design question

  • 16-12-2009 05:59PM
    #1
    Registered Users, Registered Users 2 Posts: 462 ✭✭


    Im looking to do a simple intranet in the office that can be used to access/modify MYSQL DB records. My question is what is the best practice for programming a records page and its different modes eg create, edit, delete, validate etc.

    I was thinking of doing one page staff.php with a switch statement working off a URL variable for the mode ie ?mode=create, ?mode=edit. Each section of the switch would then be programmed for each of the options create, edit, delete.

    I also need modes for validate (for validating entered data), confirm (for confirmation to delete a record), insert (for creating new records in the DB), update and remove (for deleteion from DB). I would then use another URL variable 'return' to tell the page where to go if theres trouble ie if when validating data and error is found 'return' to edit mode or 'return' to create mode.

    Is this a good way of doing this page and keeping it neat and logical or is there a better way. The only downside I can think of is any HTML code for each pages text and forms will have to be printed with echo statements and therefore have lots of '\'s put in to cater for quotes.


Comments

  • Registered Users, Registered Users 2 Posts: 2,021 ✭✭✭ChRoMe


    If your creating a html table populated with data from the database, your only going to need to use a few loops. Your method seems fine, just don't have any logic mixed with the html.


Advertisement