html - How can I combine multiple textarea sets within PHP to output to a file? -
currently have form 3 text areas.
there button sends data php backend , creates word document of data , downloads user. multi-line textarea issue running having trouble getting proper formatting within word document.
so example if textarea setup so:
textbox1 textbox2 textbox3 file1 n/a 600 file2 use tab 1 1000 file3 use tab 2 200
i expect output in word document just
file1 n/a 600 file2 use tab 1 1000 file3 use tab 2 200
but is
file1 file2 file3 n/a use tab 1 use tab 2 600 1000 200
in format. however, if had 1 line (say file1 line) output how want to. how can setup php string format desired output? php
if (strlen($multipleimports) > 0) { $content = $content . "\n\n" . "imports:\n "; $content = $content . $multipleimports . $multipleimportsinfo . $multipleimportscounts; }
this ended working me:
$multipleimports = explode("\n",$multipleimports); $multipleimportsinfo = explode("\n",$multipleimportsinfo); $multipleimportscounts = explode("\n",$multipleimportscounts); $content = $content . "\n\n" . "imports:\n "; $length = count($multipleimports); ($i = 0; $i < $length; $i++) { $content = $content . $multipleimports[$i] . " " . $multipleimportsinfo[$i] . " " . $multipleimportscounts[$i] . "\n "; }
Comments
Post a Comment