John Ziebro

Print and web designer extraordinaire

OOP Graphic RepresentationEven though it was a good concept, the oop code in my last post was no where near working. After a little bit of research I came up with two classes that create form fields for web pages. In the process I learned about abstract classes and protected, private and public variables and functions. Abstract classes can have other classes extend them, but not be instantiated themselves. A protected variable is only available in the class it is defined in. Private variables are available in that class and those that extend it. Finally, public classes are available to all other classes. (Correct me if I’m wrong on the public status)

Here is a working example:
test.php

Here are the source files (for you curious types):
     The class file:
     formElements.class.phps
     The test page:
     test.phps

After reviewing all this, I just realized that I left out the functionality to display values in the field if you have previously saved data, such as from a database query. Ill add in that functionality later.

Now that I seem to have OOP in hand (though I know I still need tons of practice) I am going to try my hand at integrating some AJAX to spice things up. Here is a collection of PHP / AJAX resources.

One Response to “Second PHP5 OOP Attempt”

  1. Fixed the bug that displayed a select field’s options as an attribute.

    Added functionality to display data from previously saved submissions. This created a new error where the value for select fields is missplaced but works for all other fields. This will be fixed soon.

    John Ziebro

Leave a Reply