在这里,我有一个代码,例如从 index.php 获取数据,如果用户输入数据,它将显示为表格,并且它应该通过电子邮件发送到一些预定义的邮件。但是在这里我动态地获取数据,我尝试使用 $_REQUEST 和 $_POST 两种方法来获取数据,但是在邮件函数中我试图更改消息参数但是通过 php 标签它没有采用并显示一些语法错误。
请在此处查看代码
<?php
$to="xxxxxxx@gmail.com";
$fn="Fisrt Name";
$ln="Last Name";
$name=$fn.' '.$ln;
$from="xxxxx@xxx.com";
$subject = "Welcome to Website";
include('newsmtp/smtpwork.php');
?>
<?php
$message = 'Dear $firstName,
Your Welcome Message.'.'
<table border=1>
<tr>
<td>First Name:</td>
<td><?php $firstName=$_POST['firstname'];
echo $firstName;?></td>
</tr>
<tr>
<td>Last Name:</td>
<td><?php $lastname=$_POST['lastname'];
echo $lastname;?></td>
</tr>
<tr>
<td>Title:</td>
<td><?php $title=$_POST['title'];
echo $title;?></td>
</tr>
<tr>
<td>Address:</td>
<td><?php $address=$_POST['address'];
echo $address;?></td>
</tr>
<tr>
<td>Phone Number:</td>
<td><?php $phone=$_POST['phone'];
echo $phone;?></td>
</tr>
<tr>
<td>Course Name:</td>
<td><?php $course=$_POST['coursename'];
echo $course;?></td>
</tr>
<tr>
<td>Website:</td>
<td><?php $website=$_POST['website'];
echo $website;?></td>
</tr>
</table>
Thanks
xxxxxxxxxxxx
';
?>