Well if register_globals is off (like they should be) then you are overwriting the $username with both these lines as per you example
<?php
session_start();
$_SESSION['user_name'] = $_POST['user_name'];//set to $_Post variable
$_SESSION['user_name'] = $user_name;//Now it is set to nothing
?>
On the page to add to database :
<?php
session_start();
$_SESSION['user_name'] = $_POST['user_name'];//Same as above
$_SESSION['user_name'] = $user_name;
?>
First you need to remove the $_SESSION['user_name'] = $user_name; and keep the $POST variable then when you need the $SESSION['user_name'] just make a short variale like
$user_name=$_SESSION['username'];