I have a page where I am using facebox(http://chriswanstrath.com/facebox/) Basically it allows you to display a popup using div and it loads the content from an external page. In my case the popup has a form that when submitted is supposed to call a page that generates a pdf. I want to be able to display the popup, submit the form, make the popup disappear, and get the file downloaded without my original page to change. In other words I want the whole popup-submit thing to behave just like if I clicked on an href.
Right now if I put a target="_blank" I get a new page. And if I live it like this, it will replace my current page iwth a white page, and the files is downloaded.
I am sure there is some javascript code that I need.
The only thing in the main page is the link
Code: Select all
<a href="external_page.php?id_post=42" rel="facebox">Generate Document</a>
Code: Select all
<?php
if (isset($_GET['submitbtn']))
{
$url = url built from several options
header("Location: $url"); //THIS PAGE IS THE ONE THAT GENERATES THE PDF
}
?>
<body>
<form action="_wnd_docgen.php" method="get">
Document: <select><options...></select>
<input type="submit" id="submitbtn" name="submitbtn" value="Go"/>
</form>
</body>