Jump to content

Scrolling php NEED HELP


ratt831

Recommended Posts

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");

?>

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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");
  
?>

Link to comment
Share on other sites

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.

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.