title: How to rename a file or folder using php in dynamic way?
body: <p>I need to rename any file or folder on my Web-based system in dynamic way by getting the Oldname from $_REQUEST["item"] &amp; the Newname from prompt box, my javascript code is :</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  var name;
  function rename(){
     var  name= prompt("Please enter a new name for the item:", "");
      if (name=="")
          rename();          
  }
  &lt;?php $name ?&gt;=  name;
  
  &lt;/script&gt;
  
  &lt;a  onclick="rename()" href="index.php?action=rename&amp;newname=&lt;?php echo $name; ?&gt;&amp;item=&lt;?php echo $value["path"]; ?&gt;" &gt;Rename&lt;/a&gt;
  </code></pre>
  
  <p>where is the $value["path"] is the link for each item in the page</p>
  
  <p>Php function :</p>
  
  <pre><code>private function rename() {
      rename($_REQUEST["item"], $_REQUEST["newname"]);
     }
  </code></pre>
  
  <p>my .htaccess file :</p>
  
  <pre><code>RewriteEngine On
  RewriteRule ^(.*)/index.php$ index.php?controller=$1&amp;%{QUERY_STRING} [L]
  </code></pre>
  
  <p>there is a lot of code to open file &amp; to call my function the problem is that $_REQUEST["newname"] is Undefined variable &amp; the prompt box doesn't appear??</p>
  
  <p>Note:there is no problem with calling the function ^_^</p>