title: How to sent a post value in createElemen() in dom. it keeps getting error
body: <p>This is my dom : How to use a variable $name in createElement() so that it can be an element. i try many ways but it same like this.</p>
  
  <pre><code>$node = $dom-&gt;documentElement;
  $phone = $node-&gt;appendChild($dom-&gt;createElement("model"));
  $phone-&gt;setAttribute('type', $type);
  $tolol = $phone-&gt;appendChild($dom-&gt;createElement(&lt;?php echo $name;?&gt;));
  $tolol-&gt;setAttribute('id', $id);
  
  $tolol
    -&gt;appendChild($dom-&gt;createElement('displaySize'))
    -&gt;appendChild($dom-&gt;createTextNode($display));
  </code></pre>
  
  <p>this is output that i want:</p>
  
  <pre><code>&lt;model type="Microsoft Lumia"&gt;
  &lt;lumia id="550"&gt;
    &lt;displaySize&gt;4.7 inches (~64.7% screen-to-body ratio)&lt;/displaySize&gt;
    &lt;platformOS&gt; Microsoft Windows 10&lt;/platformOS&gt;
    &lt;network&gt;2G,3G,4G&lt;/network&gt;
    &lt;cameraRear&gt;5 MP, f/2.4, autofocus, LED flash&lt;/cameraRear&gt;
    &lt;cameraFront&gt;2 MP, f/2.8, 480p&lt;/cameraFront&gt;
    &lt;RAM&gt;1 GB RAM&lt;/RAM&gt;
    &lt;ROM&gt;8 GB&lt;/ROM&gt;
    &lt;chipset&gt;Qualcomm MSM8909 Snapdragon 210&lt;/chipset&gt;
    &lt;battery&gt; 2100 mAh&lt;/battery&gt;
    &lt;price&gt;MYR559&lt;/price&gt;
  &lt;/lumia&gt;
  </code></pre>
  
  <p>another output:</p>
  
  <pre><code>&lt;lumia id="640 LTE"&gt;
    &lt;displaySize&gt;5.0 inches (~67.6% screen-to-body ratio)&lt;/displaySize&gt;
    &lt;platformOS&gt; Microsoft Windows 10&lt;/platformOS&gt;
    &lt;network&gt;2G,3G,4G&lt;/network&gt;
    &lt;cameraRear&gt;8 MP, f/2.2, 28mm, autofocus, LED flash&lt;/cameraRear&gt;
    &lt;cameraFront&gt;1 MP, 720p&lt;/cameraFront&gt;
    &lt;RAM&gt;1 GB RAM&lt;/RAM&gt;
    &lt;ROM&gt;8 GB&lt;/ROM&gt;
    &lt;chipset&gt;Qualcomm MSM8926 Snapdragon 400&lt;/chipset&gt;
    &lt;battery&gt; 2500 mAh&lt;/battery&gt;
    &lt;price&gt;MYR699&lt;/price&gt;
  &lt;/lumia&gt;
  &lt;/model&gt;
  </code></pre>