【发布时间】:2015-11-21 04:28:46
【问题描述】:
好的,所以目前我的 html 表单收集数据并将其发布到 php 表单,然后创建并发送电子邮件(以下代码),但是现在我需要该表单来创建 mailto 链接,以便我可以将其发送到与我的 iphone6 不同的邮件帐户,有什么帮助吗???!!! :)
代码是:
<?php
ini_set( "SMTP", "localhost" );
ini_set( "smtp_port", "25" );
if ( isset( $_POST['caseref'] ) ) {
$email_from = "dave@dave.com";
$to = "dave@dave.com";
$email_subject = "Arrival: " . $_POST['caseref'];
function died( $error ) {
// error code here
echo "We are very sorry, but there were error(s) found with the form you submitted. ";
echo "These errors appear below.<br /><br />";
echo $error . "<br /><br />";
echo "Please go back and fix these errors.<br /><br />";
die();
}
// validation expected data exists
if ( !isset( $_POST['casreref'] ) ) {
#died('We are sorry, but there appears to be a problem with the form you submitted.');
}
$name = $_POST['name']; // required
$caseref = $_POST['caseref']; // required
$notes = $_POST['notes']; // required
$error_message = "";
$email_message .= "Incident Number: " . $caseref . "\n";
$email_message .= "Arrival Date:" . date( " d/m/Y " );
$email_message .= "\n";
$email_message .= "Arrival Time:" . date( " H:i ", time() );
$email_message .= "\n";
$email_message .= "Engineer: " . $name . " \n";
$email_message .= "Engineers Notes: " . $notes;
$email_message .= "\n";
$email_message .= "\n";
$email_message .= "\n";
$headers = 'From: ' . $email_from;
mail( $to, $email_subject, $email_message, $headers );
?>
<!-- include your own success html here -->
<html>
<title>Thank you!</title>
Mailto link needs to go here
<?php
}
?>
谁能帮我解决这个问题?
电子邮件需要如下所示:
邮箱:davey@dave.com
主题:到达
正文:事故编号:XXXXXX
到货日期:20/11/2015
到达时间:14:41
工程师:戴夫
工程师笔记:
【问题讨论】:
-
这是 HTML 101 的东西。
-
这只是 html,而不是火箭科学。
echo '<a href="mailto:....">blahblah</a>'; -
你能给我看看吗?我无法将变量(html 表单的输出)传递到 HTML 字符串中......对不起,我没有编写这段代码,我不是程序员!
-
echo '<a href="mailto:....">*meh*</a>'; -
我认识 mailto 的人,但是如何将页面中的数据解析到 mailto 链接中?