Re: Writing to Heredoc from Text Area Form



At Thu, 31 May 2007 09:45:02 -0500, Matt F let h(is|er) monkeys type:

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.

I don't understand what $template is supposed to contain. Can you give an
example of what it might look like and what you want to do with it?

And I am missing a }. should that be following the $hostarray assignment?
In that case you probably mean $hostarray[] = explode(",", $val);

This would leave you with $hostarray looking like:
$hostarray[0][0]: <row 0, field 0>
$hostarray[0][n]: <row 0, field n>
....
$hostarray[m][0]: <row m, field 0>
$hostarray[m][n]: <row m, field n>

Maybe it would be easier (not sure how your file was populated to begin
with) to serialize the arrays, write those to a file, read them in this
script and unserialize them again.


--
Schraalhans Keukenmeester - schraalhans@xxxxxxxxxxxxxxxxxxxxxx
[Remove the lowercase part of Spamtrap to send me a message]

"strcmp('apples','oranges') < 0"

.



Relevant Pages

  • Re: Populate a Multi-Column ListBox
    ... It seems to me that I should somehow be able to directly populate ... ListBox column 1 with an array of state names created using the Split ... Dim myArray1 As Variant ...
    (microsoft.public.word.vba.userforms)
  • Re: Populate a Multi-Column ListBox
    ... It seems to me that I should somehow be able to directly populate ... ListBox column 1 with an array of state names created using the Split ... Dim myArray1 As Variant ...
    (microsoft.public.word.vba.userforms)
  • Re: Populate a Multi-Column ListBox
    ... two-dimensional array to load into a ListBox or ComboBox. ... For a multicolumn ListBox or ComboBox, AddItem inserts an entire row, ... If you populate a ListBox with an Array using the List of Column ... Dim myArray As Variant ...
    (microsoft.public.word.vba.userforms)
  • Re: Populate a Multi-Column ListBox
    ... two-dimensional array to load into a ListBox or ComboBox. ... For a multicolumn ListBox or ComboBox, AddItem inserts an entire row, ... If you populate a ListBox with an Array using the List of Column ... Dim myArray As Variant ...
    (microsoft.public.word.vba.userforms)
  • Re: Populate a Multi-Column ListBox
    ... two-dimensional array to load into a ListBox or ComboBox. ... For a multicolumn ListBox or ComboBox, AddItem inserts an entire row, ... If you populate a ListBox with an Array using the List of Column ... Dim myArray As Variant ...
    (microsoft.public.word.vba.userforms)