PHP Code:
$name=$_POST["username"];
if(!isset($name) || empty($name)){
die("Please select your image!");
}else{
You can't refer to $_POST['username'] if it isn't set.
PHP Code:
if (!isset($name) || empty($name)) {
die("Please select your image!");
} else {
// now we can refer to it..
$name = $_POST["username"];
You could pass the value as a get, rather than post, value - although not recommended!
PHP Code:
window.location = "display.php?name=$name"; // then refer to it in display.php..
if (isset($_GET['name']) // etc..
But you've already stored it as a session variable, so you can check and retrieve this value:
PHP Code:
if (isset($_SESSION["CID"])) {
BTW Use of the
mysql library is deprecated/discouraged, although nobody seems to be getting this message

.
IF you are not sure, check the
docs, including the comments.