Training, Open Source Programming Languages

This is page

Our email: • Phone: 01144 1225 708225

For 2023 - we are now fully retired from IT training.
We have made many, many friends over 25 years of teaching about Python, Tcl, Perl, PHP, Lua, Java, C and C++ - and MySQL, Linux and Solaris/SunOS too. Our training notes are now very much out of date, but due to upward compatability most of our examples remain operational and even relevant ad you are welcome to make us if them "as seen" and at your own risk.

Lisa and I (Graham) now live in what was our training centre in Melksham - happy to meet with former delegates here - but do check ahead before coming round. We are far from inactive - rather, enjoying the times that we are retired but still healthy enough in mind and body to be active!

I am also active in many other area and still look after a lot of web sites - you can find an index ((here))
Application design in PHP - multiple step processes

When you're putting together a multiple step process in PHP (and that could be anything from a forum to an ordering system), you should bare in mind that each of the program elements will be the 'intermediate' step that takes you from one display to the next ... and that you can't be sure when page "X" has been completed that the next page to be presented really WILL be page "Y" - after all, if the user has failed to enter his password correctly on page "X" you'll want to redisplay it ...

... so here, in principle, is how your code should look. Your application will pick up form data and any existing information from the user's session, then "finish" processing from those inputs. Part of that finishing process will be making the decision as to what page to move onto next, so after finishing from page "X" the code will prepare for page "Y", or page "X" again perhaps. Upon completion of those preparations, the (newly updated) session is saved away, and a template for the new page completed.

Rather than store all the code associated with such a multipage application in one file / logical area, we'll usually split it up. The top level code goes into one file, the "business logic" - code to do the actual application work - into another. A third file contains the "web helpers" - routines which handle the forms, sticky fields, web principles, etc. And a fourth file contains a template - what the web page presented will actually look like.

By splitting the code in this way, it becomes easier to maintain as it's in sensible sized chunks. It also allows for elements to be reused in other areas of the web site / application - for example, a template might be shared right across a site, web helpers across many sites, and the business logic may be used offline as well as on the web. Finally, the division principle allows each section to be independently looked after by experts in that section - you need staff who are masters at each individual trade rather than staff who can dabble a bit in all areas.

If you have heard about MVC ("Model View Controller") parts of what I have written may sound very familiar indeed ... and that is no accident!

We have a sample 'shell' of an application that goes through a multistep process using these principle and you can run it here. Source code is here (top level), here (business logic), here (web helpers) and here (template).

This subject is taught briefly on our learning to program in PHP and PHP programming courses, and much more fully covered during our PHP techniques workshop
(written 2009-05-11)

Associated topics are indexed as below, or enter for individual articles
H302 - PHP - MVC, 4 layer model and templating
  [1634] Kiss and Book - (2008-05-07)
  [1716] Larger applications in PHP - (2008-07-22)
  [1766] Diagrams to show you how - Tomcat, Java, PHP - (2008-08-22)
  [2199] Improving the structure of your early PHP programs - (2009-05-25)
  [2221] Adding a newsfeed for your users to a multipage PHP application - (2009-06-06)
  [3454] Your PHP website - how to factor and refactor to reduce growing pains - (2011-09-24)
  [3539] Separating program and artwork in PHP - easier maintainance, and better for the user - (2011-12-05)
  [3956] Zend / layout of MVC and other files in an example application (PHP) - (2012-12-16)
  [4066] MVC and Frameworks - a lesson from first principles in PHP - (2013-04-19)
  [4114] Teaching CodeIgniter - MVC and PHP - (2013-06-12)
  [4314] PHP training - refreshed modern course, backed up by years of practical experience - (2014-11-16)

Back to
Basic OO principles
Previous and next
Horse's mouth home
Forward to
Melksham in pictures
Some other Articles
Melksham Candidates for Wiltshire Unitary Election
Preventing forum spam - checks at sign up
Balloon Journey in Wiltshire
Melksham in pictures
Application design in PHP - multiple step processes
Basic OO principles
PHP4 v PHP5 - Object Model Difference
Cleaning up redundant objects
Designing a heirarcy of classes - getting inheritance right
When should I use OO techniques?
4759 posts, page by page
Link to page ... 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96 at 50 posts per page

This is a page archived from The Horse's Mouth at - the diary and writings of Graham Ellis. Every attempt was made to provide current information at the time the page was written, but things do move forward in our business - new software releases, price changes, new techniques. Please check back via our main site for current courses, prices, versions, etc - any mention of a price in "The Horse's Mouth" cannot be taken as an offer to supply at that price.

Link to Ezine home page (for reading).
Link to Blogging home page (to add comments).

© WELL HOUSE CONSULTANTS LTD., 2023: 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • EMAIL: • WEB: • SKYPE: wellho

PAGE: • PAGE BUILT: Sun Oct 11 16:07:41 2020 • BUILD SYSTEM: JelliaJamb