Login Retreive lost passwordRegister
Search

Manual  /  Getting Started  /  A Simple Tutorial

A Simple Tutorial

Description:

Okay, so you have downloaded FormHandler (FH) and uploaded it to your server. What now?
First of all you need to realize that FH is a tool that will allow you to build forms on a easy way. It is not a drag and drop application which will make your forms. You still need to write your own forms (only then with the help of FH)!

Ok, now that that is out of the way, we should be getting started with using FH. Please note that I will not explain in the examples below how every function works! Use the manual! There are examples how to use the function on allmost every page in the manual!

To start using FH, you should have a script where you are going to make the form. For example, "test.php".
Now you have to make sure that the file "class.FormHandler.php" is included into that file:

<?php

// include the class
include("FH3/class.FormHandler.php");

?>


Now you have to make a new object of the FormHandler class.

<?php

// include the class
include("FH3/class.FormHandler.php");

// create a new FormHandler object
$form = new FormHandler();

?>

Now you can start making your form. (So setting some fields e.g.)
When you are done with that you have to give FormHandler the name of the function you want to use if the form is submitted and valid. You can do this with the function onCorrect. Finally you have to flush the form so that it will be send to the visitors browser.

<?php

// include the class
include("FH3/class.FormHandler.php");

// create a new FormHandler object
$form = new FormHandler();

// some fields.. (see manual for examples)
$form->textField"Name""name"FH_STRING2040);
$form->textField"Age""age"FH_INTEGER42);

// button for submitting
$form->submitButton();

// set the 'commit-after-form' function
$form->onCorrect('doRun');

// display the form
$form->flush();

// the 'commit-after-form' function
function doRun$data 
{
    echo 
"Hello "$data['name'].", you are ".$data['age'] ." years old!";
}

?>

Of course you can change the fields and so. It's all in the manual!
After writing the script, upload it and request it with your browser. Your'e done!

If you still cant make FH work, use the forum.

Latest change: 05 March 10 / 08:25

Comments

powered by PHP-GLOBE   © 2004 - 2024 FormHandler. All rights reserved.   -   Open source license