php - passing one variable from one page to another for pdf generation -


i have page have used retrieve excel data written in php... using phpexcel... part provides me company information

echo '<form action="final.php" method="post">';             echo "<table border='1'>";                ($rowcount = $rowcompanyinfostart; $rowcount <= $rowcompanyinfoend; $rowcount++)             {               //$data = $objworksheet->rangetoarray('a1:' . $maxcell['column'] . $maxcell['row']);             $rangecoordinates = $colcompanyinfostart . $rowcount . ':' . $colcompanyinfoend . $rowcount;             $rowdata = $sheet->rangetoarray($rangecoordinates, null, true, false);                     echo "<tr>";                $companyname=$worksheet->getcell($column.$row)->getvalue();             //  echo $companyname;                  foreach($rowdata[0] $result)                                                  {              echo "<td>".$result." </td>";                              }                       echo "</tr>";             }                 echo "</table>";              echo "<br />";         echo    '<input type="submit" name="sub" value="convert pdf" />';     //  echo '<input type="text" name="resname" value="$result">';          function getdatan()  {     global $result; // declare global    return $result;     }        echo '</form>'; 

this part company information... looks table area shown down part...

enter image description here

i retrieve info , able show "$result" variable , submit button named "convert pdf" send other php page use tcpdf ....

normally, part of second page

 $pdf->setfont('times', 'bi', 12);      // add page     $pdf->addpage('l', 'a4');      if(isset($_post['submit']))             {     $result = $_get['resname'];     $pdf->write(20, $result, '', 0, 'c', true, 0, false, false, 0);           }            // set text print     $txt = <<<eod     tcpdf example 003     custom page header , footer defined extending tcpdf class , overriding header() , footer() methods.     eod;      // print block of text using write()     // $pdf->write(20, $resultt, '', 0, 'c', true, 0, false, false, 0);     // ---------------------------------------------------------      ob_end_clean();     //close , output pdf document     $pdf->output('example.pdf', 'i'); 

however, unable print "$result" in second page... can me how print table on pdf...

ps: please clarify help...

try this

change : echo '<input type="submit" name="sub" value="convert pdf" />';

to:

echo    '<input type="submit" name="resname" value="convert pdf" />'; 

edit

put @ begining of second page:

var_dump($_post);  

just check receiving first page.

also change :

 $result = $_get['resname']; 

to this:

 $result = $_post['resname']; 

Comments

Popular posts from this blog

javascript - oscilloscope of speaker input stops rendering after a few seconds -

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -