Need preview page before send email [closed]

Further to my comment, what I mean by splitting up the sendMail.php (you will, of course, have to modify your main page javascript to accommodate a confirm response from your sendMail.php):

if(isset($_POST['data']) && is_array($_POST['data']) ) {
        foreach($_POST['data'] as $data) {   }
        $datatList = implode(', ', $_POST['data']);
    $datatList  =   $_POST['data'];

if(!isset($_POST['confirm'])) {

        $name       =   strip_tags($_POST['name']);
        $email      =   strip_tags($_POST['mail']);
        $age        =   preg_replace('/[^0-9]/','',$_POST['age']);
        $data       =   strip_tags($datatList);
            <td colspan="2">
                <form id="confirm" method="post" action="">
                    <input type="hidden" name="name" value="'.$name.'" />
                    <input type="hidden" name="mail" value="'.$email.'" />
                    <input type="hidden" name="age" value="'.$age.'" />
                    <input type="hidden" name="data" value="'.$data.'" />
                    <input type="submit" name="confirm" value="Confirm" />
        echo json_encode(array("confirm"=>true, "message"=> $response));
else {
        $send_for_address   = "[email protected]";
        $header             = "From: [email protected]";
        $messages           = "Name: $_POST[name]\n";
        $messages           .= "Email: $_POST[mail]\n";
        $messages           .= "Age : $_POST[age]\n";
        $messages           .= "Work $datatList\n";  
        mail($send_for_address, $messages,$header);
        if (mail($send_for_address, $messages,$header)) {
                $response = <<<HTML
<div class="alert">
    <div class="alert-header"><div class="alert-remove layerOff">×</div></div>
    <div class="alert-body fs0_7">
        Thank you for your applicaion!
    <div class="alert-footer">
        <input type="button" value="OK" class="layerOff">
                echo json_encode(array("success"=>true, "message"=> $response));

Browse More Popular Posts

Leave a Comment