save_custom_template.php
<?php
$dsn = 'mysql:dbname=wyg;host=localhost';
$pdo = new PDO($dsn,"user","pass_word");
$update = $pdo->prepare(
"INSERT INTO template(templateHtml,groupName,friendlyName,description) "
."VALUES(:templateHtml,:groupName,:friendlyName,:description)");
$_POST['groupName'] = 'Custom Template';
$_POST['description'] = 'custom description';
$_POST['friendlyName'] = $_POST['templateName'];
$_POST['tagName'] = 'custom_tag';
function fromPost($array){
$ret = [];
foreach ($array as $bind=>$postKey){
$ret[$bind] = $_POST[$postKey];
}
return $ret;
}
print_r($_POST);
$bind = fromPost(
[':friendlyName'=>'friendlyName'
,':groupName'=>'groupName'
,':description'=>'description'
,':templateHtml'=>'templateHtml']);
print_r($bind);
$update->execute($bind);
print_r($update->errorInfo());
return;
header("Location: /wyg/builder/");
exit;