title: Add page URL to an email sent via a PHP form
body: <p>I'd like to add the URL of the page from where the message was sent (I have a contact form at the end of each page of my website) to the body of the e-mail generated via the code below. What should I add to the code below? (I'm a complete beginner in PHP)
  Many thanks for your help</p>
  
  <pre><code>&lt;?php
  // Email Submit
  // Note: filter_var() requires PHP &gt;= 5.2.0
  if ( isset($_POST['email']) &amp;&amp; isset($_POST['name']) &amp;&amp; isset($_POST['message']) &amp;&amp; filter_var($_POST['email'], FILTER_VALIDATE_EMAIL) ) {
  
    // detect &amp; prevent header injections
    $test = "/(content-type|bcc:|cc:|to:)/i";
    foreach ( $_POST as $key =&gt; $val ) {
      if ( preg_match( $test, $val ) ) {
        exit;
      }
    }
  
    //send email
    mail( "dsfds@sfss.com", "Nouveau message de: ".$_POST['name'], $_POST['message'], "From:" . $_POST['email'] . "\r\n" . "BCC:dsfds@gmail.com" );
  
  }
  ?&gt;
  </code></pre>