View Single Post
Old 11-29-2011, 04:12 AM   PM User | #5
BluePanther
Senior Coder

 
Join Date: Jul 2011
Posts: 1,226
Thanks: 3
Thanked 171 Times in 171 Posts
BluePanther is on a distinguished road
They've used javascript, which I personally wouldn't have used. I know a little javascript and would consider changing the button type input to a submit type, and adding the onSubmit event with the function call.

But, I'm not in a position to test that. So, what I would do is get rid of the relevant javascript and instead, have a script called subdir.php and change the form to this:
Code:
<form action="subdir.php" method="post">
<div id="container">
<h1></h1>
<input type="text" name="subdir">
<input type="submit" value="OK">
</div>
</form>
Then, in subdir.php, I would have this:
PHP Code:
// Put user requested subdir into variable. Probably needs cleaning, in case of 'dodgey' url's containing things like .. or /'s
$subdir $_POST['subdir'];
header('location: http://www.example.com/'.$subdir.'/'); 
That will redirect the user to the subdir they entered - whether they pressed enter or clicked the button. Using PHP allows for expansion and a more secure environment to navigate folders in my opinion.
BluePanther is offline   Reply With Quote
Users who have thanked BluePanther for this post:
drakerehfeld (11-30-2011)