Hi patelxxx,
The code you posted does create a directory ("folder") based on the user's input and then creates another folder inside it called "hai". Is that not what you wanted it to do?
I should point out one, presumably unintended, effect of your current code: if someone runs this code and answers "foo" for the name of the directory to be created, your code as written includes the newline from <STDIN> in the variable $dir. Assuming you don't want the new directory to be called "foo\n" (displayed on my system and probably many others as "foo?") you should write:
- $dir = <STDIN>;
-
chomp $dir;
-
mkdir($dir);
where chomp removes the newline from the end of $dir.
Otherwise, what is your question?
You say you're "trying to create a new folder in a 'Drop Down Menu'," What do you mean by that. If you're trying to create a web page that includes a drop-down menu, then it doesn't make sense to create directories in your local filesystem? If you are trying to include a function in a drop-down menu, then something like your current code works for that, but how you include it in what kind of menu is quite unclear. Why are you asking about JavaScript? JavaScript is used within a web page to control web browser activities and is not really supposed to allow your browser to modify your local filesystem. (That would be a terribly bad security hole.)
Overall, I get the feeling that you are trying to do something very different from what your posts actually say you are trying to do. This may be a language problem.
Paul