Form generator in php
<p>Hi I am a beginner PHP deveoloper and I am trying to create a form generator.I am having some problems with the generated form.When I click for example the "Paragraph" button a form is generated that contains a text field and another button.</p>

<p>I would like when I enter some text in the generated code and press the button to execute some function in my case just print the text.</p>

<p>This is my code:</p>

<pre><code>&lt;form action="" method="post"&gt;
   &lt;button type="submit" name ="Paragraph"&gt;Paragraph Text&lt;/button&gt;
   &lt;button type="submit" name ="MultipleChoice"&gt;Multiple Choice&lt;/button&gt;
   &lt;button type="submit" name ="Name"&gt;Name&lt;/button&gt;
   &lt;button type="submit" name ="Adress"&gt;Address&lt;/button&gt;
   &lt;button type="submit" name ="Number"&gt;Number&lt;/button&gt;
   &lt;button type="submit" name ="CheckBoxes"&gt;Checkboxes&lt;/button&gt;
   &lt;button type="submit" name ="DropDown"&gt;Drop Down&lt;/button&gt;
   &lt;button type="submit" name ="Phone"&gt;Phone&lt;/button&gt;
   &lt;button type="submit" name ="Email"&gt;Email&lt;/button&gt;
&lt;/form&gt;

&lt;?php 
   require_once 'addform.php';
   $buttons = array('Paragraph', 'MultipleChoice', 'Name', 
              'Adress', 'Number', 'CheckBoxes', 'DropDown', 'Phone', 'Email');
   foreach ($buttons as $button){
     if(isset($_POST[$button])){
        $title;
        $input;
        if($button == 'Paragraph'){
           ?&gt;
           &lt;form action="" methods="post"&gt;
             Paragraph title: &lt;input type="text" name="title"/&gt;
             &lt;input type="submit" value="Create" name="create"/&gt;
           &lt;/form&gt;
           &lt;?php
           if(isset($_POST['title'])){
             $title = $_POST['title'];
             echo $title;
           }
        }
     }
     break;
}
?&gt;
</code></pre>

<p>What am I doing wrong here?</p>
