如何发送和电子邮件确认php表单

时间:2019-04-11 02:12:47

标签: php forms email

我正在为即将在Dance Studio拍摄的照片准备php表单。因此,在我创建或更新个人资料后,我想发送一封电子邮件,以便我的客户可以确认他们收到了我的消息,并且我表格中的电子邮件是正确的。

到目前为止,我具有以下代码,但是将其上传到主机服务(hostgator共享)后,我收到确认页面,提示已发送电子邮件,但是我从未在收件箱中收到电子邮件。

[51683.266902] hv_vmbus: probe failed for device 2450ee40-33bf-4fbd-892e-9fb06e9214cf (-19)

send.php

<?php

//get ID sent by GET collection
$parentID = intval($_GET['id']);

include('connection.php');
include('functions.php');

//query the database with client ID
$query = "SELECT * FROM users WHERE id='$parentID'";
$result = mysqli_query( $conn, $query );

if( isset( $_GET['alert'] ) ) {

    //new client added
    if( $_GET['alert'] == 'success' ) {
        $alertMessage = "<div class='alert alert-success'>New client added!<a class='close' data-dismiss='alert'>&times;</a></div>";
        //client updated
    } else if( $_GET['alert'] == 'updatesuccess' ) {
        $alertMessage = "<div class='alert alert-success'>Client has been updated!<a class='close' data-dismiss='alert'>&times;</a></div>";
        //client deleted
    } else if( $_GET['alert'] == 'deleted' ) {
        $alertMessage = "<div class='alert alert-success'>Client has been deleted!<a class='close' data-dismiss='alert'>&times;</a></div>";
    }
}

if( mysqli_num_rows($result) > 0 ) {

    //we have data
    //set some variables
    while( $row = mysqli_fetch_assoc($result) ) {
            $parentName = $row['p_name'];
            $parentEmail = $row['email'];
            $studentName = $row['s_name'];
            $parentPhone = $row['phone'];
            $notes = $row['notes'];
            $parentDeposit = $row['deposit'];
            $packageNotColl = $row['Package-NotCollected'];
            $depositNotColl = $row['deposit-not-collected'];
        }
    } else {
            $alertMessage = "<div class='alert alert-warning'>Nothing to see here.<a href='list.php'>Head back</a></div>";
}

mysqli_close($conn);

include('header.php');

?>

<?php echo $alertMessage; ?>

<div id="print-div">

    <div class="container">

        <div class="eduarto-title">
            <h2>EDUARTO'S<strong>PHOTOGRAPHY</strong> / Agreement</h2>
            <h2>Alouettes Dance Academy Picture Day</h2>
        </div>
        <hr>

        <div>
            <ul class="big">
                <li>A deposit is required to take the picture of the student. This deposit will be applied towards your first package order. This deposit is non refundable and/or transferable.</li>
                <li>Packages include 1 pose only</li>
                <li>Make sure to provide us with your preferred email address, where you will receive the link for the student gallery.</li>
            </ul>
        </div>

        <div class="form-group col-sm-12">
            <h3>Student Name: <em><?php echo $studentName; ?></em></h3>
        </div>
        <div class="form-group col-sm-12">
            <h3>Email address: <em><?php echo $parentEmail; ?></em></h3>
        </div>
        <div class="form-group col-sm-12">
            <h3>Deposit: <em><?php echo $parentDeposit; ?></em></h3>
        </div>
        <div class="form-group col-sm-12">
            <h3>Notes: <em><?php echo $notes; ?></em></h3>
        </div>
        <div class="form-group col-sm-12">
            <h3>Parent Name: <em><?php echo $parentName; ?></em></h3>
        </div>

        <hr>
    </div>      

</div>

<form action="printVersion.php?id=<?php echo $parentID ?>" target="blank" method="post" class="row">
    <div class="print-button pull-right">
        <a href="list.php" type="button" class="btn btn-md btn-default">Go back</a>
        <button type="submit" class="btn btn-med btn-warning" name="confirm-print">Print version</button>
    </div>
</form><br>

<form action="send.php?id=<?php echo $parentID ?>" method="post" class="row">
    <div class="print-button pull-right">
        <button type="submit" class="btn btn-med btn-success" name="send">Send Email</button>
    </div>
</form>

<?php

include('footer.php');

谢谢

0 个答案:

没有答案