我正在創建一個網頁,用戶通過表單選擇一個數字。我有麻煩與PHP讀取文件插入不同名稱的txt文件到html
HTML:
<form method="POST" style="font-size: 30px">
<input type="number" id="idname" name = "na" value=168 />
<label for="idname" >Number< /label>
<p><input type = "submit" name = "gesendet" value="Submit" />
<input type = "reset" /> </p>
</form>
使用PHP我想根據號碼中插入一個txt文件,如12_.txt或166_.txt
<?php
$txtfile='"txt/' . $_POST["na"] . '_.txt"';
readfile($txtfile);
?>
的$ txtfile字符串是OK的時候「echoing」,當我讀取一個沒有$ _POST變量的文件時,readfile函數與我一起工作,但是這個簡單的代碼對我來說並不合適!
不工作__how__? –
順便說一句 - 爲什麼你使用單引號和雙引號? –