Line 81 you have:
<?php $userid = $_SESSION['UserID'] ?>
then on line 99 you have:
<?php header("Location: member_update.php?UserID=".$userid); ?>
The problem is that UserID isn't always set yet. But line 99 is in an IF statement so it is only used after login. I'd probably just delete line 81 and and update line 99 to:
<?php header("Location: member_update.php?UserID=".$_SESSION['UserID']); ?>