Question: How to populate current page title (or current url) to the subject line via mailto?

Been using the code below as a starting point, obviously modifying the "Page Title Here" bit, but can't find a solution:

```
<?php echo "<a href='mailto:test@test.com" . $to . "?subject=Page Title Here" . $subject . "'>Send an email</a>";?>

```

Answer: 
Set page title to php var as 

```
$title = 'Example';

```

and use it for 

```
<title><?=$title;?></title>

```

and mail 

```
 <?php echo "<a href='mailto:test@test.com" . $to . "?subject=" . $title . $subject . "'>Send an email</a>";?>

```
This is not generically possible with PHP. PHP has no knowledge of what the page title is, or your HTML structure at all.

You will have to go to your code where you set the page title, and use that same variable in your e-mail. If this PHP code is handling a post from some page or something, you need that page title posted with your form data (which you can get with JavaScript `document.title`).