forked from jwiegel/FormHandler
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
78 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
|
||
declare(strict_types=1); ?> | ||
<!DOCTYPE html> | ||
|
||
<head> | ||
<meta charset="utf-8"> | ||
</head> | ||
|
||
<body> | ||
<?php | ||
|
||
define('FH_FHTML_DIR', 'http://formhandler.test/src/FHTML/'); | ||
ini_set("display_errors", "1"); | ||
@error_reporting(E_USER_WARNING | E_ALL); | ||
|
||
require_once '../../vendor/autoload.php'; | ||
|
||
// make a new formhandler object | ||
$form = new dbFormHandler(); | ||
$form->dbInfo("formhandler", "test", "mysqli"); | ||
$form->dbConnect("localhost", "formhandler", "formhandler"); | ||
|
||
$form->dateField("DateField", "datefield"); | ||
$form->dateField("DateField1", "datefield1", null, true); | ||
$form->dateField("DateField2", "datefield2", null, true, "D-M-Y"); | ||
$form->dateField("DateField3", "datefield3", null, null, "D-M-Y"); | ||
$form->dateField("DateField4", "datefield4", null, false, "D-M-Y"); | ||
|
||
// submitbutton | ||
$form->submitButton("Save"); | ||
|
||
// set the onCorrect function | ||
$form->onCorrect("doRun"); | ||
|
||
// flush | ||
$form->flush(); | ||
|
||
// commit after form function | ||
function doRun($data) | ||
{ | ||
echo print_r($data); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
declare(strict_types=1); ?> | ||
<!DOCTYPE html> | ||
|
||
<head> | ||
<meta charset="utf-8"> | ||
</head> | ||
|
||
<body> | ||
<?php | ||
|
||
define('FH_FHTML_DIR', 'http://formhandler.test/src/FHTML/'); | ||
ini_set("display_errors", "1"); | ||
@error_reporting(E_USER_WARNING | E_ALL); | ||
|
||
require_once '../../vendor/autoload.php'; | ||
|
||
$form = new FormHandler(); | ||
$form->timeField("Time", "time"); | ||
$form->timeField("Time2", "time2", required: true); | ||
|
||
$form->flush(); | ||
|
||
function mOnCorrect(array $fields, FormHandler $fh) | ||
{ | ||
var_dump($fields); | ||
var_dump($fh); | ||
} | ||
|
||
// function to show a message | ||
function doRun($data) | ||
{ | ||
return print_r($data); | ||
} |