Unable to get the text boxes and labels to be printed dynamically in php and HTML
<p>I have this code and it should print labels with text boxes for people to fill in information. It takes a text like : $tokens = "*noun *noun *verb" and should print to the user a table that has :</p>

<p>Noun: (text box to be filled)
Noun: (text box to be filled)
verb: (text box to be filled) etc.</p>

<p>but it is not working</p>

<pre><code>echo "&lt;form action=\"storygenerated.php\" method=\"post\"&gt;
        &lt;input name=\"fields\" type=\"hidden\" value=\"$tokens\" /&gt;
        &lt;input name=\"story\" type=\"hidden\" value=\"$story\" /&gt;
        &lt;table&gt;";
for ($i = 0; $i &lt; count($tokenArray); $i++) {
    $fieldWords = split('_',$tokensArray[$i]);
    echo "&lt;tr&gt;&lt;td&gt;";
    echo $fieldWords[0];
    for ($j = 1; $j &lt; count($fieldWords); $j++) {
        echo " ".$fieldWords[$j];
    }
    echo ":";
    echo "&lt;/td&gt;&lt;td&gt;&lt;input name=\"$tokensArray[$i]\" type=\"text\" /&gt;&lt;/td&gt;&lt;/tr&gt;";
}
</code></pre>

<p>which is from this code that is generating the text $tokens</p>

<pre><code>$storyArray = split(' ', $story);
$tokens = ""; // space-delimited list of fields
$tokensArray=array();
for ($i = 0; $i &lt; count($storyArray); $i++) {
    if ($storyArray[$i][0] == '*') {  
        $tokens .= $storyArray[$i] . " ";
        $tokensArray[] = $storyArray[$i];
    }
}
</code></pre>
