Archive for the ‘PHP’ Category

How to list all entries in a directory using PHP

It displays both "." and ".." entries also.

if ($handle = opendir('/path/to/files')) {
    echo "Directory handle: $handle\n";
    echo "Entries:\n";
    /* This is the correct way to loop over the directory. */
    while (false !== ($entry = readdir($handle))) {
        echo "$entry\n";
    /* This is the WRONG way to loop over the directory. */
    while ($entry = readdir($handle)) {
        echo "$entry\n";

Read more »

HTML5 download Attribute

The download attribute allows you to set a separate file download name than the actual link endpoint itself.
Place the download attribute on a link in html file.
<!– will download as "" –>
<a href="" download="">Download Sample File</a>
..and when the user clicks the link, the download attribute appears in the save dialog instead of the garbled mess that was there before.

Read more »

Auto Complete Text box using AJAX in PHP


To download code – Click Here

To view the live demo please enter your country name.

Read more »