so you want the previous updated image on the page when turning back?
if(isset($_SESSION ['currentUserID'])){
echo "<h1> Upload an image of yourself here!</h1>
<form action='myProfile.php' method='POST' enctype='multipart/form-data'>
<input type='file' name='file'>
<br><br><button type='submit' name='submit'>Upload photo</button>
</form>";
$id =$_SESSION['currentUserID'];
echo "<img src='uploads/profile".$id.".jpg'/>";
}
error_reporting(E_ALL);
ini_set('display_errors', 1);
...