don't unconditionally loop over $_POST data. hackers/bots can submit 100's or 1000's of fields (php had to add a setting to limit the number of fields), with their own field names (which will allow sql injection in the query), not yours. you should instead have an array the defines the expected fields, then use this definition to control what your code does. this is referred to as a data-driven design.
see this example -
// define the expected form fields
$fields = ['easting', 'northing', 'purpose', 'country', 'admin1', 'admin2', 'admin3', 'settlement',
'orig_wellno', 'date_completed', 'coord_sys', 'elev', 'status'];
$col = []; // array of columns
$data = []; // array of prepared query input values
// add the well no
$col[] = '`well_no`';
$data[] = $_SESSION['well_no']; // use whatever the actual session variable is
// loop over the defining array
foreach($fields as $field)
{
// note: empty considers 0 or '0' to be an empty value. this will prohibit a numerical zero value being used.
// you should instead test if the value is or is not an empty string.
if($_POST[$field] !== '')
{
$col[] = "`$field`";
$data[] = $_POST[$field];
}
}
// build the sql query
$sql = "INSERT INTO well_parent (".implode(',',$col).") VALUES (".implode(',',array_fill(0,count($col),'?')).")";
// examine the result
echo $sql;
echo '<pre>'; print_r($data); echo '</pre>';