calling php file fron another php file while passing arguments
You don't have to pass anything in to your included files, your variables from the calling document will be available by default;
File1.php
<?php
$variable = "Woot!";
include "File2.php"; //if in the same folder
File2.php
<?php
echo $variable;
the location in your code is incorrect:
$cmd = "/.../myfile.php?file=".$name;