Part-Time News

View All
The continuation of the tutorial on making a membership based web site.



Before I get started, though, let me answer the obvious question: Since most forms are perfectly happy with a single submit button, why would anyone ever need two (or more)? The best way to explain such a need is with an actual example from the last project I worked on. In that project, I was tasked with building an inventory system for a book-lending library. The book titles were all stored in a database, and administrators could use a browser-based interface to view the record for any book and then perform one of four actions on that record: check out to a member, check in from a member, mark as missing, and mark as sold. All these activities were handled through a single form, which had buttons corresponding to the actions above. Depending on which button was clicked, the data entered in the form was processed in a different way (check in/out was connected with membership records; mark as missing/sold updated inventory tables). Since a form can only have a single action, the same PHP script had to handle all four tasks, by identifying which button had been clicked and executing the appropriate code branch. Thus, a need arose for a single form carrying multiple submit buttons, and a