Writing to Heredoc from Text Area Form



I can't seem to get heredoc to populate correctly with variables through
a form.

<textarea name="Template" rows="10" cols="80">Template Here</textarea>

Contents could be something like: I want to replace $myarray[0] and
another variable $myarray[1]

I call heredoc this way:

$hubarray = explode("\n", $contents);
$template = $_POST['Template'];

foreach ($hubarray as $val) {
$hostarray = explode(",", $val);

$output = <<<EOT
$template
EOT;

I'm feeding it a file that has multiple rows separated by \n as array 1
and within those rows are fields separated by "," for array 2. I'm
trying to iterate through the arrays and populate heredoc($template)
accordingly.
.



Relevant Pages

  • Re: [PHP] why use {} around vraiable?
    ... $parameters = array( ... When I asked for some help awhile back on a project I was working on and they said to use HEREDOC, and gave an example of how to do it and they had all the variables surrounded with So I assumed you had to do it that way... ... Jason Pruim ... Technology Manager ...
    (php.general)
  • Re: array of here documents
    ... Is there any reason you wouldn't set up the heredocs first and then add ... them to an array? ... This is the second heredoc. ...
    (comp.lang.ruby)
  • Re: Newbie - expecting `T_STRING or `T_VARIABLE or `T_NUM_STRING
    ... Philip Olson wrote: ... > or heredoc has ken suggests. ... > well simply use concatenation instead. ... The reason I started to use an array, was that I like to put a carriage ...
    (comp.lang.php)