表單提交後我無法獲得$_POST['value']
。
我已經使用javascript爲輸入字段賦值。 代碼:
function updateValue(pid, value){
// this gets called from the popup window and updates the field with a new value
document.getElementById(pid).value = value;
}
上述功能是通過一個彈出寡婦叫的值賦給我的輸入字段:pid
這裏是form
腳本:
<form action="test.php" method="post">
<input type="text" name="project_name" id="pid" disabled="disabled" />
<input type="submit" id="search" name="search" value="Search" />
</form>
在我的測試。我已經做了:
include 'functions.php'; //Has the connection script
if (isset($_POST['search'])){
echo $project_id = $_POST['project_name'];
$sql = mysql_query("SELECT * from item
where category like '$project_id %'
");
echo $num = mysql_num_rows($sql);
}
但我我得到錯誤:Undefined index: project_name
請將'print_r($ _ POST)'的結果添加到您的PHP腳本的開頭。 –
啊,我沒有看到你的「禁用」屬性... –