Your code misses error handling and the way you create the xpath expression is prone to injection which can also easily break it.
$xpath = new DOMXPATH($xml);
$expression = "/root/info[name = '$c_name']";
$result = $xpath->query($expression);
if (false === $result) {
throw new InvalidArgumentException(
sprintf(
'Xpath expression %s failed for input %s'
, var_export($expression, true)
, var_export($c_name, true)
)
);
}
foreach($result as $node)
{
$node->parentNode->removeChild($node);
}
This example does not yet handle the injection issue just introduces proper error handling so that you realize as early as possible where the error actually occurs.
If you then analyze it further you might spot a problem with single quotes. A previous Q&A covers that topic: