<div align="center">Time
            <select name="select">
   <?php
foreach (glob("*.txt") as $filename) {?>
     <option value="<?php echo $filename ?>" name="<?php echo $filename ?>">
   <?php echo $filename ?></option>
   <?php
}
?>
</select>
        </div>
 <?php$file = 'txt.txt';
?>
怎么让$file 这个跟select选择了以后,跟这个附值起来了?

解决方案 »

  1.   

    <select name="select" onchang='location.href'+'?fn='+this.value'>
    $file = $_GET['fn'];
      

  2.   


    $file = $_POST['select'];
      

  3.   

    如果是两个文件呢?<?php$file = 'txt.txt';
    ?>在另外一个 s.php
    <?php
    require_once('s.php');
    ?>这样不行啊。
      

  4.   

    不行啊。  Warning: file_get_contents() [function.file-get-contents]: Filename cannot be empty in /home/content/05/7711405/html/droppeddomain/index.php on line 141
    No matches found