我想知道如何在联系表单中加粗表达某些文字。我对此有点新意。我想对表单的输出进行分类。例如:
联络资料:(以粗体显示)
名称:
电子邮件:
。
。
。
活动/旅行详情:(以粗体显示)
乘客数量:
。
。
到目前为止,我只有“联系信息:”和“活动/旅行详情”。我不知道如何勇敢面对他们。
$formcontent="Contact Information: \n \nName: $name \n \nEmail: $email
\n \nPhone: $phone \n \nCompany / Group Name: $cmpny \n \nStreet Name:
$street \n \nCity, State, Zip Code: $city_st_zip \n \nRespond Via:
$respond \n \nEvent / Trip Details: \n \nNumber of Passengers:
$num_passengers \n \nTrip Type: $trip_type \n \nNumber of Pickups:
$num_pickups \n \nBus Size: $bus_size \n \nName: $pickup_name \n
\nStreet Name: $pickup_street_name \n \nCity, State, Zip Code:
$pickup_city_st_zip \n \nDepart Date: $depart_date \n \nDepart Time:
$depart_time \n \nName: $dropoff_name \n \nStreet Name:
$dropoff_street_name \n \nCity, State, Zip Code: $dropoff_city_st_zip
\n \nReturn Date: $dropoff_date \n \nReturn Time: $dropoff_time \n
\nItinerary / Special Instructions / Additional Info: $spec_instr \n
\nAirport Meet & Greet: $meet_greet \n \nADA Accessible Coach: $ada \n
\nExtra Storage: $extra \n \nHow did you find us? $find_us";
$recipient = "jldouglas58@gmail.com";
$subject = "Request for a Quote";
$mailheader = "From: $email \r\n";
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
header( 'Location: http://www.distancebrothers.com/quote-
confirmation.html') ;?>
答案 0 :(得分:1)
首先,电子邮件标题声明邮件是HTML格式。
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
然后用HTML格式化邮件 例如:
$formcontent="<html> <body>Contact Information: \n \nName: <strong>$name </strong>\n \nEmail: $email
\n \nPhone: $phone \n \nCompany / Group Name: $cmpny \n \nStreet Name:
$street \n \nCity, State, Zip Code: $city_st_zip \n \nRespond Via:
$respond \n \nEvent / Trip Details: \n \nNumber of Passengers:
$num_passengers \n \nTrip Type: $trip_type \n \nNumber of Pickups:
$num_pickups \n \nBus Size: $bus_size \n \nName: $pickup_name \n
\nStreet Name: $pickup_street_name \n \nCity, State, Zip Code:
$pickup_city_st_zip \n \nDepart Date: $depart_date \n \nDepart Time:
$depart_time \n \nName: $dropoff_name \n \nStreet Name:
$dropoff_street_name \n \nCity, State, Zip Code: $dropoff_city_st_zip
\n \nReturn Date: $dropoff_date \n \nReturn Time: $dropoff_time \n
\nItinerary / Special Instructions / Additional Info: $spec_instr \n
\nAirport Meet & Greet: $meet_greet \n \nADA Accessible Coach: $ada \n
\nExtra Storage: $extra \n \nHow did you find us? $find_us </body> </html>";
答案 1 :(得分:0)
据我所知,您希望将该丑陋的文本打印为HTML代码。使用<strong>
标记将文字设为粗体:
<strong>Name:</strong>
答案 2 :(得分:0)
<strong> Contact Information:</strong> Name:
<strong> Email: . . . Event / Trip Details:</strong> Num of passengers: . .
内容必须是HTML。您可以在本网站找到免费的电子邮件模板,以使其更好;
https://colorlib.com/wp/responsive-html-email-templates/
并且您的内容是一个变量,这意味着PHP的变量(如名称,电子邮件)无法读取。您需要解析内容变量。