• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 523
  • Last Modified:

Opening multiple reports in new windows using variables

I have a page that sends an array to the code below.  I want to open a new window for each fpdf document that is produced.   I know the code below can't work but how can I?  I have tried using Javascript to open a new window, but I was unsuccessful in passing the PHP variable.  Any help is greatly appreciated.   Thank you.
<?php
	include 'include/userConnect.php';
error_reporting(E_ALL);
           $userIDKey=$userListRow['id'];
           $repKeyArray=$_POST['reprocessingKeys'];
$i = 0;
        foreach ( $repKeyArray as $editID => $value) {


        

     
'include/reports/reprocessingLetters/checkRequest.php?reprocessingKey='. $value;
'include/reports/reprocessingLetters/deposit.php?reprocessingKey='. $value;
'include/reports/reprocessingLetters/presentEmpl.php?reprocessingKey='. $value;
'include/reports/reprocessingLetters/priorEmpl.php?reprocessingKey='. $value;
'include/reports/reprocessingLetters/mortgage.php?reprocessingKey='. $value;
'include/reports/reprocessingLetters/gift.php?reprocessingKey='. $value;
'include/reports/reprocessingLetters/vvoe.php?reprocessingKey='. $value;
'include/reports/reprocessingLetters/rental.php?reprocessingKey='. $value;
'include/reports/reprocessingLetters/borrCert.php?reprocessingKey='. $value;
'include/reports/reprocessingLetters/otherIncome.php?reprocessingKey='. $value;
'include/reports/reprocessingLetters/VVOE.php?reprocessingKey='. $value;
             $i++;   
             }
             
             ?>

Open in new window

0
rcowen00
Asked:
rcowen00
3 Solutions
 
Jagadishwor DulalBraces MediaCommented:
Where is your fpdf code? There may be some query and function to execute pdf before you do it. But one suggestion may work that is pass your link to a _blank which will open a new page. Like:

<a href="somepage.php?var1=value&var2=value" target="_blank">Open in New Window</a>

Open in new window


It will open a new window with your variables values.
0
 
ProculopsisCommented:

...if you wanted the windows to open automatically:

<script>
<?php
$value = 1;

$docArray = array( 'checkRequest.php', 'deposit.php', 'presentEmpl.php', 'priorEmpl.php', 'mortgage.php', 'gift.php', 'vvoe.php', 'rental.php', 'borrCert.php', 'otherIncome.php', 'VVOE.php' );

foreach ( $docArray as $i => $document ) {
  echo 'window.open( "include/reports/reprocessingLetters/' . $document . '?reprocessingKey=' . $value . '" );';
}
?>
</script>

Open in new window

0
 
Ray PaseurCommented:
You can open a lot of new windows, but I personally find that to be annoying and pop-up blockers may get in your way.  A slightly different design pattern might be easier on your clients.  Consider writing each FPDF document to the file system of your server and give your client a link to each PDf file.  Example of doing this in the code snippet and online here:
http://www.laprbass.com/RAY_fpdf_hello_world.php

Best regards, ~Ray
<?php // RAY_fpdf_hello_world.php


// DEMONSTRATE THE BASICS OF FPDF


// BRING IN THE PDF THING
require_once('fpdf16/fpdf.php');


// SYNTHESIZE THE PDF FILE INFORMATION
$pdf_file_link = '/RAY_junk/' . 'temp_pdf_blue' . '.pdf';
$pdf_file_name = getcwd()     . $pdf_file_link;

// DO THE HELLO WORLD EXERCISE IN WHITE ON A BLUE BACKGROUND
$pdf=new FPDF();
$pdf->AddPage();
$pdf->SetFont('Arial', 'B', 16);
$pdf->SetFillColor(  0,   0, 255);
$pdf->SetTextColor(255, 255, 255);
$pdf->Cell(40, 10, 'Hello World!', 0, 2, 'L', TRUE);

// WRITE THE PDF TO DISK
$pdf->Output($pdf_file_name, 'F');

// PRESENT A LINK
echo '<a target="my_PDF" href="' . $pdf_file_link . '">Blue PDF</a>';


// START OVER FOR A NEW PDF
unset($pdf);
echo PHP_EOL . "<br/>";

// SYNTHESIZE THE PDF FILE INFORMATION
$pdf_file_link = '/RAY_junk/' . 'temp_pdf_red' . '.pdf';
$pdf_file_name = getcwd()     . $pdf_file_link;

// DO THE HELLO WORLD EXERCISE IN WHITE ON A RED BACKGROUND
$pdf=new FPDF();
$pdf->AddPage();
$pdf->SetFont('Arial', 'B', 16);
$pdf->SetFillColor(255,   0,   0);
$pdf->SetTextColor(255, 255, 255);
$pdf->Cell(40, 10, 'Hello World!', 0, 2, 'L', TRUE);

// WRITE THE PDF TO DISK
$pdf->Output($pdf_file_name, 'F');

// PRESENT A LINK
echo '<a target="my_PDF" href="' . $pdf_file_link . '">Red PDF</a>';

Open in new window

0
 
rcowen00Author Commented:
Thank you for your responses.  Ray the client doesn't want to click more than one link, so I am going to try Proculopsis suggestion.  I will get back to you.
0
 
rcowen00Author Commented:
I ended up using if statements within the FPDF document to open all letters in one window.  Thanks for the assistance gentlemen.
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now