I am building a website that produces an image using the GD library from user supplied form data (the background image is already set for the user). In short the user types specific info on a postcard that my company will later print on a digital press. The results are targeted to an "iframe" on the same page where the user submits the data. This creates the online proof instantaneously without the need of Adobe Acrobat. I use two submit buttons. One (Preview) creates the online proof, the second one (Continue) sends the data to a new page for the final stage, which is shipping info etc.
What I need is the second button (Continue) to pass the data to a NEW page and not target the "iframe".
After hacking around for a day the best solutions I can come up with is (A & 😎 but neither is what I need:
A: Both results loading in the "iframe". See code below...
<?php
if(isset($POST['preview']))
{
$string = $POST['text'];
$string2 = $POST['text2'];
include 'process_gd_lib.php';
}
elseif(isset($POST['order']))
{
include 'stage3.php';
}
?>
<IFRAME name="iframe1" width="525" height="425" align="center" scrolling="no" frameborder="0">
<!-- Alternate content for non-supporting browsers -->
<H2>No Support</H2>
<H3>You need to update your browser</H3>
</IFRAME>
<form action="<?=( $_SERVER['PHP_SELF'] )?>" method="post" target="iframe1" >
<input type="submit" name="order" value=" Order " />
<input type="submit" name="preview" value=" Preview " />
Text 1: <input name="text" type="text" id="text" size="30">
Text 2: <input name="text2" type="text" id="text2" value="" size="34">
</form>
B: Instead of "PHP_SELF" I send the post data to a page that that contains:
<?php
if(isset($POST['preview']))
{
$string = $POST['text'];
$string2 = $POST['text2'];
include 'process_gd_lib.php';
}
elseif(isset($POST['order']))
{
include 'shipping_info.php';
}
?>
(Originating page has just the "iframe" code as well as the form and buttons...)
The problem with this is that it creates a new page when either button is clicked.
Thus being neither A or B completely solves my problem...
Being a real newbie I don't know what to do to get one button (Preview) to target the "iframe" on the orginating page and the other button (Continue) to create a new page when the user is done proofing his postcard. Is there a better way?
Drowning in a pool of code...:eek: