Create a template file with the letter text in it and something like
%%variable%% where the variable text would go.

After you've done that, set up your preview page like:

<form action="script.php" method="post">
<!-- Do this for each variable in the letter or one big variable for
$contents -->
<!-- but keep in mind there's a size limit on variables being passed -->
<input type="hidden" name="variable" value="<?php echo $variable ?>">

    // Reads all the lines of the file into an array and
    // then joins the lines into one variable
    $contents = join("", file("letter.txt"));

    // Do one line like this for each variable
    $contents = str_replace("%%variable%%", $variable, $contents);

    print "$contents";

<input type="submit" value="Send Message">


If you set the HIDDEN tags to individual variables as opposed to $contents,
remember that you still need to do the following code again to send the

    $contents = join("", file("letter.txt"));
    $contents = str_replace("%%variable%%", $variable, $contents);

Hope that helps.

Mike Frazer

"Reggie White" <[EMAIL PROTECTED]> wrote in message
> Hi. I'm new to PHP, and forgive me if I sound ridiculous but I have to
> I'll be as clear as possible.
> I'm trying to do mail handling in php. I know already about the  mail( )
> function, but what it does isn't exactly what I need.
> I have an html form that posts the contents of it's field to a php
> The php document is an html template of a formal letter where the contents
> of the form are passed into the letter as variables where appropriate. The
> user is able to preview the letter when they are done modifying it.
> Now here's where I'm stuck. When the user is finished previewing the html
> letter, I want two things to happen: When the user submits, I want the
> itself (with the variable in it) to be emailed to a specified recipient. I
> also want a blind copy of specific information from the form to be email
> me for reporting purposes.
> Is this possible? and how?
> Thanks everyone,
> Reginald White

PHP General Mailing List (
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to