title: How to Integrate a PHP form with Smarty?
body: <p>I am trying to add a web contact form to a website that uses Smarty PHP templates.</p>
  
  <p>My initial attempt (below) produces a blank webpage. </p>
  
  <p><strong>.tpl file</strong></p>
  
  <pre><code>{debug}
  {extends file='toxtweet.tpl'}
  {block name=body}
      &lt;form action="" method="post"&gt;
      {foreach from=$formitems as key=name item=value}
          &lt;label for={$name}&gt;{$value}&lt;/label&gt;
          &lt;input type="text" name={$name} size="50"/&gt;
      {/foreach}
      &lt;input type="submit" value="E-mail" /&gt;
      &lt;/form&gt;
  {/block}
  </code></pre>
  
  <p><strong>.php file</strong></p>
  
  <pre><code>&lt;?php
     include 'base.php';
     include './scripts/recaptchalib.php';
     $formitems = parse_ini_file("formitems.ini");
     $smarty -&gt; assign('formitems',$formitems);
     $smarty -&gt; display("contact.tpl");
   ?&gt;
  </code></pre>
  
  <p><code>base.php</code> and <code>toxtweet.tpl</code> work fine in all the other pages so I don't think they are the problem. <code>recaptchalib.php</code> has the proper path. </p>
  
  <p>If remove the <code>{foreach} ... {/foreach}</code> lines, the blank webpage displays properly. The error persists if I use the format <code>{foreach $x as $y}</code> or <code>{foreach from=$x key=k value=v}</code>. </p>
  
  <p>The debug shows that the <code>ini</code> file with the values for <code>formitems</code> was loaded properly.</p>