Menu

Genrate PDF after form POST

Help
Abdalla
2014-12-12
2014-12-31
  • Abdalla

    Abdalla - 2014-12-12

    I try to generate pdf report from mySQL database. The user open a form and then when he click submit it call a php file which retrieve the appropriate data and then generate the PDF from an extended class of TCPDF.

    The Problem is as follow...
    When i open a form and click submit the pdf is opened in a new tab but if i click submit again the pdf is opened in the same tap not a new one.

    if i open multiple forms in multiple tab the generated pdf is opened opeSned in one tab for all forms, and each time i resubmit a form it opened in the same old tab.

    how can i fix this so that each time i submit a form it open the generated pdf in a new tap.

     
  • cpw

    cpw - 2014-12-19

    If you set the "target" attribute of your "form" tag to "_blank", every click on the submit button should open a new tab:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de">
    
    <head>
        <title>Test</title>
        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    </head>
    
    <body>
    
        <form action="target.php" target="_blank">
            <input type="submit" value="submit" />
        </form>
    
    </body>
    
    </html>
    

    BTW: This has nothing to to with TCPDF itself.

     
    • Abdalla

      Abdalla - 2014-12-27

      I already did that, after i click submit a new tab is opened, but when i click submit again (With different form fields e.g. change the selected value in dropdown list ) the new pdf is opened in the same previous tab (the one that display pdf in the first time) not in a new one.

       
  • cpw

    cpw - 2014-12-31

    Are you sure you're using "_blank" (with underscore!) as a target and not just "blank"?

    If so, in which browser and browser version do you experience that problem? Can you provide a code example to reproduce the problem?

     
  • Abdalla

    Abdalla - 2014-12-31

    you was right, i missed the underscore..
    Thank you in advance...

     

Log in to post a comment.