我无法获得$_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>
在我的 test.php 中,我做了:
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