I have a form built using Template Engine
Dwoo
which has three variables (specific data for the attributes "name" and "value"),
this form will be inserted multiple times inside another template but since the name of the variable must be the same as the key of the array of data that is passed in the invocation of the template, so how will I make the value of these variables to be modified with each new form?
Form template code:
<form class="form-inline" role="form" action="#" method="get">
<div class="form-group">
<label for="country">Country</label>
<select class="form-control country" name="country">
<option value="all">All (WorldWide)</option>
</select>
</div>
<div class="form-group">
<button class="btn btn-default" type="submit" name={$search} value={$search}>Search</button>
<button class="btn btn-default" type="submit" name={$save_pdf} value={$save_pdf}>Save in PDF</button>
<button class="btn btn-default" type="submit" name={$save_png} value={$save_png}>Save in PNG</button>
</div>
</form>
PHP code that "printa" the template
<?php
session_start();
require_once '../../../vendor/autoload.php';
$dwoo = new Dwoo\Core();
$dwoo->setCompileDir('../../../assets/compiled/');
$dwoo->setTemplateDir('../../../assets/templates/');
$data = array();
if((isset($_SESSION['email']) == true) && (isset($_SESSION['pass']) == true)){
$data['page'] = 'site-statistics.php';
$data['search'] = 'form_1_search';
$data['$save_pdf'] = 'form_1_save_pdf';
$data['$save_png'] = 'form_1_save_png';
$dwoo->output('site-statistics.tpl', $data);
}else{
header('Location:index-admin.php');
}
?>