+ -
当前位置:首页 → 问答吧 → 如何把一个选择框中的变量转变到查询条件上来?

如何把一个选择框中的变量转变到查询条件上来?

时间:2011-12-23

来源:互联网

PHP code
  <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选择了以后,跟这个附值起来了?

作者: csharpvb   发布时间: 2011-12-23

<select name="select" onchang='location.href'+'?fn='+this.value'>


$file = $_GET['fn'];

作者: xuzuning   发布时间: 2011-12-23

PHP code

$file = $_POST['select'];

作者: zhangbin1988   发布时间: 2011-12-23

如果是两个文件呢?

<?php

$file = 'txt.txt';


?>

在另外一个 s.php


<?php
require_once('s.php');
?>

这样不行啊。

作者: csharpvb   发布时间: 2011-12-23

不知道你在说什么

作者: xuzuning   发布时间: 2011-12-23

不行啊。 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

作者: csharpvb   发布时间: 2011-12-23

谢谢了。。可啦。

作者: csharpvb   发布时间: 2011-12-23