Jump to content

2nd half of html showing up in textarea


soma56

Recommended Posts

I had a thread a few days ago inquiring about placing your results in a text box. I was told that you could wrap your html around your php code. Fair enough. I've been playing around with getting lists, placing them into arrays and echoing the results.

 

<?PHP
print <<<EOT
   <form method="post" action="" >
    <table>
      <tr>
        <td>My Grocery List:

        </td>
        <td><textarea name="list" type="text" cols="30" rows="6" id="list"></textarea></td>
      </tr>
            <tr>
        <td><input type="submit" value="Submit"></td> 
      </tr>
      
    </table>

  </form>
  <form>
  <table>
      <fieldset>
        <td><textarea name="list" type="text" cols="30" rows="6" id="list">
EOT;

if (!isset($_POST['list']))
{
//If not isset -> set with dummy value
$_POST['list'] = "";
} 
$list = trim($_POST["list"]);
$data = explode("\n", "$list"); 
foreach ($data as $value) 
echo $value;

print <<<EOT
            <tr>
        <td><input type="reset" value="Clear"></td> 
      </tr>
  </fieldset>
EOT;

?>

 

Everything works correctly however the last half of the html is inside the second text box. Where did I go wrong?

Link to comment
https://forums.phpfreaks.com/topic/204456-2nd-half-of-html-showing-up-in-textarea/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.