PHP code example of tanuki-form / formtagbinder

1. Go to this page and download the library: Download tanuki-form/formtagbinder 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/ */

    

tanuki-form / formtagbinder example snippets


$binder = new Tanuki\Utils\FormTagBinder();

echo $binder->text("name");
// <input type="text" name="name" value="">

echo $binder->email("email", [" $l => $cb){
  echo "<label>{$cb} {$l}</label>";
}
// <label><input type="checkbox" name="categories[]" value="a"> a</label>
// <label><input type="checkbox" name="categories[]" value="b"> b</label>
// <label><input type="checkbox" name="categories[]" value="c"> c</label>


echo $binder->textarea("content");
// <textarea name="content"></textarea>

$postdata = [
  "name" => "green spot",
  "email" => "[email protected]",
  "categories" => ["b", "c"]
];
$binder = new Tanuki\Utils\FormTagBinder($postdata);

echo $binder->text("name");
// <input type="text" name="name" value="green spot">

echo $binder->email("email", ["e="a"> a</label>
// <label><input type="checkbox" name="categories[]" value="b" checked> b</label>
// <label><input type="checkbox" name="categories[]" value="c" checked> c</label>