通过电子邮件发送PHP格式为pdf或

时间:2015-10-14 14:39:22

标签: php pdf-generation email-integration

我是PHP新手,并设法创建一个表单,在提交时显示php创建的网页。

我现在想要将php生成页面上显示的内容发送给某人(在这种情况下是管理员)。理想情况下是pdf格式。

所以: 1.用户填写表格 2.单击“提交” 3.表格被处理并通过电子邮件作为PDF文件发送

问题是我该怎么做?

HTML:                

<form action="somefile.php" method="POST" name="form1" id="form1" >
 <p>Hochtief (UK) Construction Ltd</p>
 <p>IT/Themis Account Request </p>
  <p>&nbsp;</p>
  <p>Please choose one of the following:  </p>
  <table width="400">
        <td><label>
        <input type="radio" name="radio1" value="Set up" required id="AddAmendDelete_0">
        Set up</label></td>

      <td><label>
        <input type="radio" name="radio1" value="Amend" id="AddAmendDelete_1">
        Amend</label></td>

      <td><label>
        <input type="radio" name="radio1" value="Delete" id="AddAmendDelete_2">
        Delete</label></td>

  </table>
  <p><br>
  </p>
  <p>Please choose one of the following:  </p>
  <table width="600">
      <td><label>
        <input type="radio" name="UserType" value="Direct Employee" required id="UserType_0">
       Direct Employee</label></td>

      <td><label>
        <input type="radio" name="UserType" value="Subcontractor" id="UserType_1">
        Subcontractor</label></td>

      <td><label>
        <input type="radio" name="UserType" value="Freelance Individual" id="UserType_2">
        Freelance Individual</label></td>

  </table>
    <p>&nbsp;</p>
    <p>
      <label for="Title">Title:</label>
      <input name="Title" type="text" required id="Title">
    </p>
    <p>
      <label for="fname">Forename:</label>
      <input name="fname" type="text" required id="fname">
  </p>
    <p>
      <label for="sname">Surname:</label>
      <input name="sname" type="text" required id="sname">
    </p>
    <p>
      <label for="location">Location (Head Office/Project Location):</label>
      <input name="location" type="text" required id="location">
    </p>
  <p>
    <label for="phone">Phone Number:</label>
    <input type="phone" name="number" id="phone">
  </p>

 <p>
    <label for="job">Job Title:</label>
    <input name="job" type="text" required id="job">
  </p>
  <p>
    <label for="sdate">Start Date:</label>
    <input name="sdate" type="date" required id="sdate">
  </p>
  <p>
    <label for="enddate">Anticipated End Date:</label>
    <input type="date" name="enddate" id="enddate">
  (Must be completed for Subcontractor/Freelance)</p>
  <p>
    <label for="line">Line Manager (Direct Employees)<br>
      Reporting Manager (Subcontractor/Freelance)
    :</label>
    <input name="line" type="text" required id="line">
  </p>
  <p>
    <label for="email">New User Email:</label>
    <input name="email" type="email" required id="email">
  </p>
  <p>
    <label for="leave">Leave Allocation (HR to complete for Direct Employees only):</label>
    <input type="number" name="leave" id="leave">
  </p>

<input type="submit">
</form>

</body>
</html>

PHP:

<p>Company</p>
  <p>Account Request </p>

  <br>
  <br>
  A
<strong><?php

$selected_radio = $_POST['radio1'];
print $selected_radio; ?></strong>

request has be made for a

<strong><?php

$selected_radio = $_POST['UserType'];
print $selected_radio; ?></strong>:
<br>
<br>
Name: <strong><?php echo $_POST["Title"];  ?>

<?php echo $_POST["fname"];  ?>

<?php echo $_POST["sname"];   ?></strong>

<br>

Location: <strong><?php echo $_POST["location"]; ?></strong>
<br>
Phone Number: <strong><?php echo $_POST["phone"]; ?></strong>
<br>
Job Title: <strong><?php echo $_POST["job"]; ?></strong>
<br>
Start Date: <strong><?php echo $_POST["sdate"]; ?></strong>
<br>
Anticipated End Date: <strong><?php echo $_POST["enddate"]; ?></strong>
<br>
Line Manager: <strong><?php echo $_POST["line"]; ?></strong>
<br>
Email Address: <strong><?php echo $_POST["email"]; ?></strong>
<br>
Leave Allocation: <strong><?php echo $_POST["leave"]; ?></strong>

0 个答案:

没有答案