我正在嘗試做一些簡單的表單驗證,確保輸入的內容不超過某個字符數限制,但似乎無法使其工作。當我嘗試運行此代碼:PHP include()問題
$str = "?id=";
$id = $_POST['ID'];
if (strlen($_POST['fname']) > 1) {
$message = "Character cannot be more than...";
include 'edit.php' . $str . $id;
exit();
}
我得到這個錯誤:
Warning: include(edit.php?id=97) [function.include]: failed to open stream: No such file or directory in /Applications/MAMP/htdocs/update.php on line 15
Warning: include() [function.include]: Failed opening 'edit.php?id=97' for inclusion (include_path='.:/Applications/MAMP/bin/php/php5.3.6/lib/php') in /Applications/MAMP/htdocs/update.php on line 15
從我一直在讀什麼,它實際上是要找的文件edit.php?id=97
,而不是尋找edit.php
和追加ID。我不知道該怎麼做。有什麼建議麼?提前致謝。
什麼是'$ str'和'$ id'值是多少? –
^id = and 97 ... –
爲什麼你在提問之前不會閱讀[documentation](http://php.net/manual/en/function.include.php)? 'Example#3 include()through HTTP' – Peter