ratt831 Posted February 26, 2010 Share Posted February 26, 2010 This shows a list with check box's and has a submit button at the bottom. I would like to write with scrolling list with submit at the bottom. Can Anyone help change please? Thank You <?php $currentdir = getcwd(); chdir("/home/site/public_html/music"); $filelist = glob("*.mp3"); if(empty($filelist)){ echo "DIR is empty.."; }else{ echo "<form action=\"filesafe.php\" method=\"POST\">Choose your files:<br />"; foreach($filelist AS $file){ if(is_file($file)){ echo "<input type=\"checkbox\" name=\"checkfiles[]\" value=\"$file\">$file<br />"; } } echo "<input type=\"submit\">\n</form>"; } chdir("$currentdir"); ?> Quote Link to comment Share on other sites More sharing options...
Psycho Posted February 26, 2010 Share Posted February 26, 2010 Please explain what you mean by a "scrolling list". From what I am seeing in the above code it will echo the results vertically on the page. Not sure what you mean by scrolling. If you want the list to dynamcally scroll on the page, then you will need to implement JavaScript. Or, maybe, you just want the restuls in a "container" on the page with scrollbars so it doesn't fill up the page. In that case, put the results in a DIV with the appropriate style properties. Quote Link to comment Share on other sites More sharing options...
ratt831 Posted February 26, 2010 Author Share Posted February 26, 2010 Thank You for the quick respond. Yes just want the results in a "container" on the page with scrollbars so it doesn't fill up the page. Can you please give me a example how to put the results in a DIV with the appropriate style properties. This is a first with me and php. Thank You Quote Link to comment Share on other sites More sharing options...
Psycho Posted February 27, 2010 Share Posted February 27, 2010 Your problem has nothing to do with PHP. It is an HTML/CSS issue: <div style="height:100px; width:100px;overflow:auto;border:1px solid #000000"> One<br /> Two<br /> Three<br /> Four<br /> Five<br /> Six<br /> Seven<br /> Eight<br /> </div> Quote Link to comment Share on other sites More sharing options...
Psycho Posted February 27, 2010 Share Posted February 27, 2010 Thank you again but I am lost How do I attach it to the php? I tried to put it all in a div but I need the submit under the scroll container?.I thought that the php code would have to be changed. Please help me out? Why you would respond to me through PM instead of this post I have no clue. I provided an example of how the resulting HTML would need to be formatted. I assumed you could implement that in your existing code. <?php $currentdir = getcwd(); chdir("/home/site/public_html/music"); $filelist = glob("*.mp3"); if(empty($filelist)) { echo "DIR is empty.."; } else { echo "<form action=\"filesafe.php\" method=\"POST\">\n"; echo "Choose your files:<br />\n"; echo "<div style=\"height:100px;width:100px;overflow:auto;border:1px solid #000000;\">\n"; foreach($filelist AS $file) { if(is_file($file)) { echo "<input type=\"checkbox\" name=\"checkfiles[]\" value=\"$file\">$file<br />\n"; } } echo "</div>\n"; echo "<button type=\"submit\">Submit</button>\n"; echo "</form>\n"; } chdir("$currentdir"); ?> Quote Link to comment Share on other sites More sharing options...
ratt831 Posted February 27, 2010 Author Share Posted February 27, 2010 Sorry! and THANK YOU SO MUCH. Worked Great! Just What I Wanted. One last question the .php that proses the script ends saying Done! This is the end code // Close and save The file fclose($fh); echo "Done!"; ?> What do I add to the code to say Done! then forward to another .html page? Thanks Again you have been so helpful. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.