Jump to content

Email Generation


eddie barzoon

Recommended Posts

I have a registration page built up.  The first page, an html-php mix, is a table with a form.  The form accepts data from the user and generates a confirmation page as well as an email message.  Here is the code I have so far:

[code]
<?

    //Intialize
    $strXML = "<?xml version='1.0' ?> \n";
    $strSubject = "Registration Confirmation page";
    $strFrom =: [email protected]";
    //Get information
    $strPrevPage = getenv ("HTTP_REFERER");
    $strCustomer = $_POST ['txtName'];
    $strTo = $_POST ['txtEmail'];
    $strPreference = $_POST ['firstBrand'];
    //Prep for pocessing
    if (empty($strCustomer) || empty ($strTo)) {header("Location: $strPrevPage");}
    //Process
    mail ($stro, $strSubject, $strMessage, $strFrom);
    //Format
    $strMessage = $strCustomer . ":  Thanks for visitng us.  You are now registered.";
    if ($strPreference == "R") {
        $strPreference = "Red";
    }
    elseif ($strPreference == "B"){
              $strPreference = "Blue";
    }
      elseif ($strPreference == "G"){
              $strPreference = "Green";
    }
    else {
    $strPreference = "None";
    }

    //Go to browser
    echo ($strXML);

?>[/code]
     
   

Will this code do what I want?  Basically I want information entered by the user to generate the registration confirmation page telling the user the registration is complete and an email sending the a notice of this as well.  I can't test it until I get to school because php is server side and i don't have access to that away from campus.  Did I do this right, will it give me both?  If not what am I putting in that is not needed, what am I missing?
Link to comment
https://forums.phpfreaks.com/topic/26731-email-generation/
Share on other sites

Oops, I forgot this piece of code to the registration page:

[code]
<?xml version="1.0" ?>
<!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">
    <head><title>Registration</title>
    <? include("../ss.shtml"); ?> </head>
    <body>
    <? include("../1.shtml"); ?>
    <h2>Emailed</h2>
    <ul>
        <li><b>Name:</b>&nbsp; <? echo ($Customer); ?> </li>
        <li><b>Address:</b>&nbsp; <? echo ($To); ?> </li>
        <li><b>Name:</b>&nbsp; <? echo ($Preference); ?> </li>
    </ul>
    <blockquote>
                      Thanks for registering.  An email has been sent for confirmation to the email address you supplied.
    </blockquote>
    <? include("../2.shtml"); ?>
        </body>
    </html>
[/code]
   
   
Link to comment
https://forums.phpfreaks.com/topic/26731-email-generation/#findComment-122288
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.