如何在Word仪表板中提交表单后显示成功消息? 此代码用于在Word press仪表板中发送邮件。邮件已成功发送,但我需要在发送邮件后显示成功消息 请帮忙。我的代码是
<div class="modal fade" id="myModal<?php echo $val->id; ?>" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Reply to <?php echo $val->mail; ?></h4>
</div>
<div class="modal-body">
<form method="POST" action="" >
<textarea style=" width: 100%; height: 155px;" name="message_content"></textarea>
<input type="hidden" name="message_id" value="<?php echo $val->id; ?>" >
<input type="hidden" name="mail_to" value="<?php echo $val->mail; ?>" >
</div>
<div class="modal-footer">
<button type="submit" name="send_mail" class="btn btn-default">Send</button>
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</form>
<?php
if(isset($_POST['send_mail'])){
$headers=array('Content-Type: text/html; charset=UTF-8');
$message=$_POST['message_content'];
$id=$_POST['message_id'];
$mail_to=$_POST['mail_to'];
echo "$message";
$message_info = wp_mail($mail_to, "hai", $message, $headers);
}
}
?>
</div>
</div>
</div>
</div>
答案 0 :(得分:1)
您尝试过
if($message_info ){
echo 'Email sent successfully';
}
如果邮件发送成功,它将显示通知