Skip to content

Commit

Permalink
new
Browse files Browse the repository at this point in the history
  • Loading branch information
tombrain committed Nov 5, 2023
1 parent ef5d6e2 commit fe1d617
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 0 deletions.
43 changes: 43 additions & 0 deletions tests/htmlTests/dbFormhandler_DateField.php
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);
}
35 changes: 35 additions & 0 deletions tests/htmlTests/formhandler_TimeField.php
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);
}

0 comments on commit fe1d617

Please sign in to comment.