big.nerd did prove you some example code. Since you're only renaming, I'd rather do this with a system call from PHP than using PHP's copy functions, myself, but to each his own.
if ($_POST['directory']) {
$dir = 'some_directory'; // original directory name
$command = 'mv "'.$dir.'" "'.$_POST['directory'].'";';
// evaluates to: mv "original directory name" "new name";
// the quotes are important for spaces.
$result = system($command, $return);
if ($return == 0) {
// return code of zero is successful mv (on ubuntu linux, at least)
echo 'Renamed directory successfully';
}
else {
echo 'There was an error renaming directory. Check your permissions?';
}
}
That should do it.
Edit: just a note - this does no checking of the input from the user, so they could potentially do some very serious damage to your filesystem. this is just example code, so clean it up and secure it as you need to.