micky1955 Posted February 27, 2007 Share Posted February 27, 2007 Help please - it's doing my head in! i'm probably missing something here but have searched for an answer to no avail. i'm using folder names on the server as links in a menu - to display thumbnail pics in chosen folder. works fine as long as the folder name is in this format - 'abc_def_ghi_jkl' but not in this format 'abc def ghi jkl'. the array $darr[] holds the folder name and will show it ok as a link but in the code shown $dirchoice only contains the folder name as far as the first space - ie. abc Any ideas please? <li><a href=<?php echo("$PHP_SELF?dirchoice=" . $darr[$x]) ?> ><?php echo($darr[$x]);?></a></li> Link to comment https://forums.phpfreaks.com/topic/40417-string-problem/ Share on other sites More sharing options...
kenrbnsn Posted February 27, 2007 Share Posted February 27, 2007 You need to put quotes around the URL in the "href" <li><a href="<?php echo $_SERVER['PHP_SELF'] . '?dirchoice=' . $darr[$x]) . '"><' . $darr[$x];?></a></li> Actually, I would just echo the entire HTML string from within PHP: <?php echo '<a href="' . $_SERVER['PHP_SELF'] . '?dirchoice=' . $darr[$x]) . '"><' . $darr[$x] . '</a></li>'; ?> Ken Link to comment https://forums.phpfreaks.com/topic/40417-string-problem/#findComment-195572 Share on other sites More sharing options...
micky1955 Posted February 27, 2007 Author Share Posted February 27, 2007 Thanks for the reply - tried both versions but for some reason they screwed up my menu formatting in a big way. Anyway, a bit rushed so i went for the easy route and used str-replace to replace the underscores from the folder names with spaces - it looks better in the menu list. when 've more time i'll have another look at this and see why it messed up the css formatting. Thanks again - Regards from Doug. aka Micky1955 Link to comment https://forums.phpfreaks.com/topic/40417-string-problem/#findComment-195600 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.