madspof Posted September 3, 2006 Share Posted September 3, 2006 i have made and eddited a script so it will will list the folders in one place and also make a link the link needs to be something like this audio2.php?directory=ramdom with the ramdom being the variable set by this script the only problem is i am getting this audio2.php?directory=%22ramdom%22 with unwanted %22 on the end and the beggening. Can anyone help me ? <?phpfunction listSubFolders ($dir, $level=0) { if ($handle = opendir($dir)) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { if (is_dir("$dir/$file")) { $indent = str_repeat('---', $level); echo "<a href=audio2.php?directory=\"$file\">$indent $file</a>" . "<br>"; listSubFolders("$dir/$file", $level+1); // list subfolders of this folder } } } closedir($handle); }}$dir = "./music"; // <-- specify folderlistSubFolders($dir);?> Link to comment https://forums.phpfreaks.com/topic/19603-getting-an-extra-22-either-side-of-the-get-url/ Share on other sites More sharing options...
AndyB Posted September 3, 2006 Share Posted September 3, 2006 echo "<a href=audio2.php?directory=". $file. ">$indent $file[/url]" . " Link to comment https://forums.phpfreaks.com/topic/19603-getting-an-extra-22-either-side-of-the-get-url/#findComment-85288 Share on other sites More sharing options...
wildteen88 Posted September 3, 2006 Share Posted September 3, 2006 Your're adding quotes into the url where you're not supposed to:echo "<a href=audio2.php?directory=[color=red]\"$file\"[/color]>$indent $file</a>"The offedning code is highlighted in red.Use this instead:[code=php:0]echo '<a href=a"udio2.php?directory=' . $file . '>' . $indent . ' ' . $file . "<a/><br />\n";[/code] Link to comment https://forums.phpfreaks.com/topic/19603-getting-an-extra-22-either-side-of-the-get-url/#findComment-85290 Share on other sites More sharing options...
madspof Posted September 3, 2006 Author Share Posted September 3, 2006 am getting this url now a%22udio2.php?directory=ramdom Link to comment https://forums.phpfreaks.com/topic/19603-getting-an-extra-22-either-side-of-the-get-url/#findComment-85293 Share on other sites More sharing options...
wildteen88 Posted September 3, 2006 Share Posted September 3, 2006 Oops, typo mistako! Use This:[code=php:0]echo '<a href="audio2.php?directory=' . $file . '">' . $indent . ' ' . $file . "<a/><br />\n";[/code] Link to comment https://forums.phpfreaks.com/topic/19603-getting-an-extra-22-either-side-of-the-get-url/#findComment-85295 Share on other sites More sharing options...
madspof Posted September 3, 2006 Author Share Posted September 3, 2006 thnks mate that was it Link to comment https://forums.phpfreaks.com/topic/19603-getting-an-extra-22-either-side-of-the-get-url/#findComment-85299 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.