Okay, let's try to break this down.
Assuming you have 3 pages. Page 1 sends the initial form data to page 2. Page 2 sends the attachement data to page 3. Page 3 processes and send the email. What you want to do is retain the information from page 1 in page 2 and then use all of the data in page 3.
This is a VERY simplified example, but will give you something to go off:
page1.php
Code: Select all
<form action="page2.php" method="post">
<input type="text" name="user_name"><br>
<input type="text" name="send_to"><br>
<textarea name="message" rows="5" cols="40"><textarea><br>
<input type="submit" value="go to next stage">
</form>
page2.php
Code: Select all
<form action="page3.php" method="post" enctype="multipart/form">
<input type="hidden" name="previous_data" value="<?php echo base64_encode(gzcompress(serialize(($_POST)))); ?>">
<input type="file" name="attachement"><br>
<input type="submit" value="go to next stage">
</form>
page3.php
Code: Select all
<?php
$initial = unserialize(gzuncompress(base64_decode($_POSTї'previous_data'])));
// do any and all processing and mail sending here
?>
So now on page3.php you have the variable '$initial' which is an array with anything that was in the original '$_POST' variable. So you can access the data such as:
Code: Select all
<?php
echo $initialї'user_name'], "<br>\n";
echo $initialї'send_to'], "<br>\n";
echo $initialї'message'], "<br>\n";
?>
Hope that helps.
Andy