0

I'm using this script:

$userdir = '../../'.$id.'/';
    $files2 = scandir($userdir);
    $ignore = array(".", "..");


    foreach ($files2 as $value) {

        if(in_array($value, $ignore)){
        }
        else {

    echo '<img class="clickableimg" id="'.$value.'" src="../../'.$id.'/'.$value.'" />';   }
    }

This is from a form when the users can choose an image and upload new images.

The problem is that I want the scandir() to fire up again when the user clicks on "refresh" without loosing form data.

Any ideas?

4

1 回答 1

1

我也倾向于使用 AJAX(换句话说,将数据传递给外部 PHP 脚本而不重新加载页面)。

互联网上和 SO 上都有成千上万的例子。当我学习 ajax 时,这非常方便:http ://www.w3schools.com/ajax/default.asp

于 2013-05-23T15:16:05.603 回答