PHP code example of html5 / fhtml

1. Go to this page and download the library: Download html5/fhtml library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

html5 / fhtml example snippets


echo fhtml("input @type=text @name=firstName @value=?", $_POST["firstName"]);

echo fhtml("div @class=style1 @style=display:block;width:100%")
        ->h1()->text("Hi there!")->end()
        ->p()
            ->input("@type=text @value=?", $someUnescapedValue);

echo fhtml("select @name=select1")->options($optionsArr, $_POST["select1"]);

$t->input("@type=text @value=$userInput"); // <- Don't do that!

$t->input("@value=?", $userInput); // <-- Right way: Will escape the value

echo fhtml("span")->text("Some text here!");


fhtml()->body()->as("body-elem")
    ->div()
        ->div()
->goto("body-elem")
    ->p();

$options = [
    "foo" => "Foo Apples",
    "bar" => "Bar Bananas",
    "baz" => "Batzen for Cats"
];

echo fhtml("select @name=sel1")->options($options, $_POST["sel1"]);

echo fhtml("input @type=text @name=name1 @value=?", $_POST["name1"]);
echo fhtml()->input("@type=text @name=name1 @value=?, $_POST["name1"]);
echo fhtml()->input(["@type=text @name=name1 @value=?, $_POST["name1"]]);

echo fhtml()->elem("input @type=text @name=name1 @value=?, $_POST["name1"]);
echo fhtml()->elem(["input @type=text @name=name1 @value=?, $_POST["name1"]]);

echo fthml()->input("@type=text @name=name1 @value=?", $_POST["name1"]);