I have completed GUI Package version 0.6. The new GUI system is capable of handling text in containers such as form(form), paragraph(p) and division(div). You can play with text styles to make it bold, italic, underlined, and more. It is also possible to create image and link type GUI components, but not a combined image-link. The new example code is given below:

PHP Code:

function __autoload($class) {
// The autoload function, a bit messy if you ask me
$class_path strtolower($class}); 
file_exists("{$class_path}.php")) include("{$class_path}.php");
    else throw new 
Exception("Fatal Error: Class {$class} either does not exist!");

"Your Username is: {$_POST['username']}";
"Your Password is: {$_POST['password']}";
"Your Confirmed Password is: {$_POST['password2']}";
"Your Email is: {$_POST['email']}";
"Your Confirmed Email is: {$_POST['email2']}";
"Your Gender is: {$_POST['gender']}";
"Your Country is: {$_POST['country']}";
$_POST['username'])) echo "<b>Error: You have not entered a username, please go back and fill in the blank.</b>";
$_POST['password']) or $_POST['password'] != $_POST['password2']) echo "<b>Error: You have not entered a password, or you have not confirmed it successfully.</b>";
$_POST['email']) or $_POST['email'] != $_POST['email2']) echo "<b>Error: You have not entered an email, or you have not confirmed it successfully.</b>";
    else echo 
"<b>You have registered successfully!</b>";

"<b><u>Registration Form</u></b>";
$form = new Form("myform");

$field = new FieldSet();
$field->add(new Legend("Required Field"));
$field->add(new Division(new Comment("Please enter your username here, it must be alphanumeric."), "username"));
$field->add(new TextField("username""admin"10));
$field->add(new Paragraph(new Comment("Please fill in your password confirmed password here.")));
$field->add(new PasswordField("password""password""123456"));
$field->add(new PasswordField("password""password2"));

$email = new Paragraph();
$email->add(new Comment("Please type your email and confirmed email here."TRUE));
$email->add(new PasswordField("email""email"));
$email->add(new PasswordField("email""email2"));

$field2 = new FieldSet(new Legend("Additional Fields"));
$radiolist = new RadioList("gender");
$radiolist->add(new RadioButton("Male""gender""male"));
$radiolist->add(new RadioButton("Female""gender""female"));
$radiolist->add(new RadioButton("Unknown""gender""unknown"));

$countries = array("Britain""France""Germany""Italy""Spain""America""Canada""Russia""Australia");
$alias = array("gbr""fra""ger""ita""esp""usa""can""rus""aus");
$default "usa";
$dropdown = new DropdownList("country");

$comment2 = new Comment("Your Citizenship: "FALSE);

$field2->add(new Comment("Your Gender: "FALSE));

$submit = new Button("Register""submit""submit");

$form->add(new Image(new Link("templates/icons/facebook.gif"), "facebook"20));
$form->add(new Image(new Link("templates/icons/twitter.gif"), "twitter"20));
The screenshot for a much more organized and informative PHP form is shown below:

I am thinking about redesigning the render() method since it is a bit messy and the way it is designed makes it difficult for GUI components inheritance(since all GUI rendering process needs to call the root object's render() method). I also need to find ways to play with font, color and other html elements. It can be a pain, but hopefully I will prevail.

The demo for GUI package v0.6 is available for download, please tell me what you think. Thx.
gui package v0.6.zip