In a PHP script, I want to edit a node and its attributes.
<config>
<Week>
<Monday from="18:00:00" to="8:00:00">true</Monday>
<Tuesday from="18:00:00" to="8:00:00">true</Tuesday>
</Week></config>
foreach ($config->Week->children() as $day){
$day = $_POST["b_".$day];
$day['from'] = $_POST[$day."_from"];
$day['to'] = $_POST[$day."_to"];
}
This does not seem to work. But this does
$config->Week->Monday = $_POST['b_Monday'];
$config->Week->Monday['from'] = $_POST['Monday_from'];
$config->Week->Monday['to'] = $_POST['Monday_to'];
Is there any way to do this in a loop so I don't have to hard-code the node names in?