Return to Snippet

Revision: 46194
at May 14, 2011 01:28 by stephcode


Initial Code
formmail.php:

if ($bUseOldVars)
{
    $aServerVars = &$HTTP_SERVER_VARS;
    $aGetVars = &$HTTP_GET_VARS;
    $aFormVars = &$HTTP_POST_VARS;
    $aFileVars = &$HTTP_POST_FILES;
    $aEnvVars = &$HTTP_ENV_VARS;
}
else
{
    $aServerVars = &$_SERVER;
    $aGetVars = &$_GET;
    
    $sSelection = $_POST['recipients'];
    $aEmails = array(
                                                'Restaurant1' => "[email protected]",
                                                'Restaurant2' => "[email protected]");

    $_POST['recipients'] = $aEmails[ $sSelection ];

    $aFormVars = &$_POST;
    $aFileVars = &$_FILES;
    $aEnvVars = &$_ENV;
}

HTML:

	    <form method="post" action="formmail.php" name="theForm">
            <input type="hidden" name="env_report" value="REMOTE_HOST,REMOTE_ADDR,HTTP_USER_AGENT,AUTH_TYPE,REMOTE_USER">
            <input type="hidden" name="good_url" value="thank-you.php" /> 
            <input type="hidden" name="subject" value="Restaurant Reservations" />
            <input type="hidden" name="mail_options" value="PlainTemplate=reservations.txt,AlwaysList" />
            <div class="form-contact-wrapper">
            
            	<div class="row-wrapper">
                	<div class="label-container"><p class="label">Name<span class="req">*</span></p></div>
                    <div class="field-container"><input type="text" name="Name" class="field" /></div>
                </div>

                <div class="row-wrapper">
                	<div class="label-container"><p class="label">Restaurant</p></div>
                    <div class="field-container">

                                        <select name="recipients" class="field form-dropdown">
                                        <option value="Unselected" selected>-- Please Choose One --</option>
                                        <option value="Restaurant1">Restaurant1</option>
                                        <option value="Restaurant2">Restaurant2</option>
                                        </select>

                    </div>
                </div>
                
                <div class="row-wrapper">
                	<div class="form-sublabel-container"><p class="form-sublabel">* Required</p></div>
                    <div class="form-submit-container"><input type="submit" class="form-submit3" name="Submit" value="" /></div>
                </div>
            </div>
            </form>

Initial URL

                                

Initial Description

                                

Initial Title
Tectite formmail email recipient split depending on dropdown selection

Initial Tags
email, dropdown

Initial Language
PHP