DISCLAIMER: Allowing the user to dictate the file to open / write / etc is dangerous. You do not want to do this.
I'd assume that you'd want to use a form input tag to allow the user to input a filename. Access it via the $_POST superglobal array, e.g.
PHP Code:
// assumes form input tag name is 'filename'
if ( !empty($_POST['filename']) ) {
// make sure you validate input better than this!!
$loadcontent= trim($_POST['filename']);
}
If you absolutely have to do this, which I recommend against, you should consider having a known list of filenames and a drop-down list for the user to select from, then test for these know filenames in the script upon input. That way they can't simply input a file on the server to manipulate.
Make sure you refer to $_SERVER[PHP_SELF] as
$_SERVER['PHP_SELF'] or you'll get undefined constant errors (or at least you should if you have the proper error_reporting level set). Additionally, the use of $_SERVER['PHP_SELF'] has been shown to be vulnerable to XSS attacks, it's advised to hardcode the script name, or at least use htmlentities() to wrap PHP_SELF value.
One other important point - don't use $_REQUEST. Use either $_GET, $_POST or $_COOKIES depending on your data source.