Accessing a variable or index that does not exists triggers a notice in PHP, and when your error reporting is on E_ALL, that notice is visible.
The problem with putting your input-variables (in this case POST) in another variable is that you are never sure they exist, because they depend on user input. The solution is to check if they exist, e.g. with isset
.
Gives a notice:
<?php
$field_cf_name = $_POST['cf_name'];
Does not give a notice:
<?php
if (isset($_POST['cf_name'])) {
$field_cf_name = $_POST['cf_name'];
}
4
solved undefined index errors PHP