简体   繁体   中英

How to get text from a table in PHP and display that text in the subject of an email via mailto link

I have a form on a website that contains a table with a title and a reference. At the bottom of this form I have a submit button that I want to create a mailto link that opens up an email with the "From" field auto filled with the users email address that they have entered in the form. I would also like to auto fill the "Subject" field with the title and reference elements from the table on the form.

Could someone please tell me how to go about this using PHP?

See also Mailto Syntax Tutorial .

When generating this link, you will need to use the same PHP statements you use in the table.

Because you haven't provided any code, here's a general approach to the matter.

Say for example, your table is populated

<table>
  <tr>
    <td>Title:</td>
    <td><?php echo $data['title']; ?></td>
  </tr>
  <tr>
    <td>Reference:</td>
    <td><?php echo $data['ref']; ?></td>
  </tr>
</table>

You would have to create the link:

<a href="mailto:email@domein.com?subject=<?php echo $data['title']; ?> - ref. <?php echo $data['ref']; ?>">Send mail</a>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM