How to send utm-tags to the mailbox with the form data after sending the form:

<input type="hidden" name="utm_source" value="<?php echo isset($_GET['utm_source']) ? $_GET['utm_source'] : '' ;?>"> <input type="hidden" name="utm_medium" value="<?php echo isset($_GET['utm_medium']) ? $_GET['utm_medium'] : '' ;?>"> <input type="hidden" name="utm_campaign" value="<?php echo isset($_GET['utm_campaign']) ? $_GET['utm_campaign'] : '' ;?>"> <input type="hidden" name="utm_term" value="<?php echo isset($_GET['utm_term']) ? $_GET['utm_term'] : '' ;?>"> <input type="hidden" name="utm_content" value="<?php echo isset($_GET['utm_content']) ? $_GET['utm_content'] : '' ;?>"> <input class="button btn1 btn1-item-inner" type="submit" name="efbf_submit" value="Отправить заявку" /> 

Created properties in the information block following the example of each input, how to connect these two entities?

  • "show the code" (c): where did you add these fields? In what form? Where are you sending it? What is in that file? - Andrewus

1 answer 1

In mail.php you take and transfer

 $utmsource = $_POST['source']; // UTM $utmmedium = $_POST['medium']; // UTM $utmcampaign = $_POST['campaign']; // UTM $utmterm = $_POST['term']; // UTM $utmcontent = $_POST['content']; // UTM $message = " source: $utmsource medium: $utmmedium campaign: $utmcampaign term: $utmterm content: $utmcontent "; mail($to, $subject, $message, $headers);