- Introduction to POG
- Setting up PHP, MySQL etc.
- Designing your objects
- Generating your code
- Description of the generated code
- Edit configuration file
- The Setup Process
- Using the code: Save()
- Using the code: Get()
- Using the code: SaveNew()
- Using the code: GetList()
- Using the code: Delete()
- Using the code: DeleteList()
- Advanced: object relations
- Advanced: Set{Parent}()
- Advanced: Get{Parent}()
- Advanced: Add{Child}()
- Advanced: Get{Child}List()
- Advanced: Save(deep)
- Advanced: Delete(deep)
- Advanced: Add{Sibling}()
- Advanced: Set{Child}List()
- Advanced: Set{Sibling}List()
- Advanced: Get{Sibling}List()
- Advanced: DeleteList(deep)
- Customizing POG-generated code
- Customizing: Extending POG Objects
- Customizing: Plugins
- Examples
- Examples: User registration system
- Examples: User authentication
- Examples: Survey form
- Examples: Using POG with AJAX
- PDO: Introduction
- PDO: SQLite example
- PDO: Firebird example
- PDO: PostgreSQL example
- PDO: MySQL example
- PDO: ODBC example
- Troubleshooting
- Troubleshooting: Data appears encoded
- Troubleshooting: Can't regenerate object
- Troubleshooting: Can't seem to Save()
- Troubleshooting: Can't get object / object attributes from database
- Troubleshooting: Can't open zip file on Mac
- Troubleshooting: Setup screen is blank
- Videos
- Appendix: Creating table(s) manually
- Appendix: Regenerating objects
- Appendix: Generating objects using SOAP
- Case Study: Gravity GTD
- Case Study: Web Form Factory
Back to the Code Generator
The POG Weblog and RSS feed.
The POG Google group
Examples: Survey form
Creating survey forms must be one of the most repetitive and boring aspect of web development. However, you can’t always simply reuse code from previous projects because each time, you need to capture different information depending on your website/product.
Using Php Object Generator in this situation saves you from the having to write everything from scratch. Actually, if you already have your web form ready and use POG to generate the database access code, you’ll probably be done in less than 15 minutes.
So, for this example, let’s assume we need to capture the following information for an employee survey form:
- Position in the company
- Employment duration
- Level of satisfaction
- Gender
- Age
- Additional comments
The easiest and fastest way to generate code for these specifications is to generate a SurveyResponse object as follows:

Then we create the web form survey as follows:

All we need to do now is process the data that’s submitted from the survey form, create a survey response object and Save it to the database.
This is the simplified code to process the data when the form is submitted:
include "include/class.database.php";
include "include/class.surveyresponse.php";
$surveyResponse = new SurveyResponse();
// we are doing extra validation before saving.
if (isset($_POST['position']))
{
$surveyResponse->employmentPosition = $_POST['position'];
}
if (isset($_POST['duration']))
{
$surveyResponse->employmentDuration = $_POST['duration'];
}
if (isset($_POST['satisfaction']))
{
$surveyResponse->satisfactionLevel = $_POST['satisfaction'];
}
if (isset($_POST['gender']))
{
$surveyResponse->gender = $_POST['gender'];
}
if (isset($_POST['age']))
{
$surveyResponse->age = $_POST['age'];
}
if (isset($_POST['comments']))
{
$surveyResponse->comments = $_POST['comments'];
}
if ($surveyResponse->Save())
{
echo "Response saved successfully";
}
DOWNLOAD SOURCE CODE FOR THIS TUTORIAL


