update_element.php
<?php
$dsn = 'mysql:dbname=wyg;host=localhost';
$pdo = new PDO($dsn,"reed","pass_word");
$update = $pdo->prepare(
"UPDATE html_elements "
."SET friendlyName=:friendlyName , description=:description , groupName=:groupName, "
."isContainer=:isContainer "
."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']);
$bind[':isContainer'] = $bind[':isContainer']? 1 : 0;
print_r($bind);
$update->execute($bind);
print_r($update->errorInfo());
header("Location: /wyg/builder/");
exit;