update_element.php

<?php

$dsn = 'mysql:dbname=wyg;host=localhost';
$pdo = new PDO($dsn,"user","pass_word");

$update = $pdo->prepare(
    "UPDATE html_elements "
        ."SET friendlyName=:friendlyName , description=:description , groupName=:groupName, "
            ."isContainer=:isContainer, templateHtml = :templateHtml "
        ."WHERE tagName LIKE :tagName");




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'
    ,':tagName'=>'tagName'
    ,':isContainer' => 'isContainer'
    ,':templateHtml'=>'templateHtml']);
$bind[':isContainer'] = $bind[':isContainer']? 1 : 0;
print_r($bind);

$update->execute($bind);

print_r($update->errorInfo());

header("Location: /wyg/builder/");
exit;