if (isset($_GET)) {
foreach($_GET as $key=>$value)
isset() check is $GET is set at all, and if it is set, it will be an array. At least as far as PHP's automatic handling of $GET goes, and the same applies to $_POST.
foreach goes through the entire array, and on the form as $key => $value, you always have both the key and the value. $value could be of course be an empty string. If you want to assign a default value instead of an empty string, you could
if ($value == '')
$value = 'default value';
But if you by missing value rather mean that you always need some elements in the array but have no guarantee that they are there, you could
$always = array('key1' = 'value1', 'key2', 'value2');
foreach ($always as $k => $v) {
if (empty($_GET[$k]))
$_GET[$k] = $v;
}
# deal with $_GET as shown before
foreach ($_GET as $k => $v)
As for overwriting data in the DB or not, that depends entirely on the query you execute and what the table looks like.