How to pass a variable to the form handler?

There is a script submit the form on the website, except the fields name and phone number it is necessary that the value of the utm tags were transferred, so registered, and the data on yutm-marks are not passed:
if ($_POST['data']['name']['value']){$body .= 'Name: '.$_POST['data']['name']['value'].'<br>';}
if ($_POST['data']['phone']['value']){$body .= 'Phone: '.$_POST['data']['phone']['value'].'<br>';}
if ($email){$body.= "utm_source: $utm_source.<br>";}
if ($email){$body.= "utm_medium: $utm_medium<br>";}
if ($email){$body.= "utm_campaign: $utm_campaign<br>";}
if ($email){$body.= "utm_term: $utm_term<br>";}
if ($email){$body.= "utm_content: $utm_content<br>";}


and in another script here is well written and successfully transferred:
if ($name){$body.= "Name: $name<br>";}
if ($phone){$body.= "Phone: $phone<br>";}
if ($email){$body.= "utm_source: $utm_source.<br>";}
if ($email){$body.= "utm_medium: $utm_medium<br>";}
if ($email){$body.= "utm_campaign: $utm_campaign<br>";}
if ($email){$body.= "utm_term: $utm_term<br>";}
if ($email){$body.= "utm_content: $utm_content<br>";}
June 14th 19 at 18:21
1 answer
June 14th 19 at 18:23
Add to the form hidden fields that will pull the labels from the address bar:
<input type="hidden" name="utm_term" value="<?php echo isset($_GET['utm_term']) ? $_GET['utm_term'] : ";?>">
<input type="hidden" name="utm_campaign" value="<?php echo isset($_GET['utm_source']) ? $_GET['utm_campaign'] : ";?>">
<input type="hidden" name="utm_content" value="<?php echo isset($_GET['utm_content']) ? $_GET['utm_content'] : ";?>">
<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'] : ";?>">


The labels yourself in the script is exactly the same using $_POST pull as the field value

Find more questions by tags HTMLPHPProgrammingWeb Development