【发布时间】:2014-08-19 10:22:58
【问题描述】:
这是我的代码
<?
$your_file = "tmp1.txt";
//open the file
$read_your_file = @fopen($your_file, "r") or die ("Couldn't Access $your_file");
//create a variable to hold the contents of the file
$contents_your_file = fread($read_your_file, filesize($your_file));
//array of file contents
$your_array = explode("\n",$contents_your_file);
//close the file
fclose($read_your_file);
//counts the number elements in the property_categories array
$num_elmnts_array = count($your_array) ;
//elements in the drop down list
//$drop_elmnts = 0;
//begin creating your dropdown menu...
$your_menu = "<select name=\"list\">";
//For loop to begin
for($counter = 0; $counter < $num_elmnts_array; $counter++){
$your_menu .= "<option value=\"$your_variable\">$your_array[$counter]</option>";
//$counter++;
}
//end select menu
$your_menu .= "</select>";
?>
<p><b>Here is my Menu</b><br>
<? echo "$your_menu";
?>
此代码有助于在 html 列表框中列出 txt 文件中的单词。我对所选值的显示有疑问。它的输出仅显示一个包含文本文件中单词的选择框。现在我想显示选定的单词。如果我从列表框中选择了选项,那么我可以在每个单词上显示和分配一个任务。
请帮助我在同一页面中显示选定的单词。或其他页面(发布方法)。
【问题讨论】:
-
在下一页: if(isset($_POST['list'])) echo $_POST['list'];
标签: c# javascript php html web-services