【发布时间】:2013-04-11 00:18:10
【问题描述】:
我有这个使用 ajax 的 php
cotizaciones.php
<script>
function showUser(str)
{
if (str == "")
{
document.getElementById("txtHint").innerHTML = "";
return;
}
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp = new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function()
{
if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
{
document.getElementById("txtHint").innerHTML = xmlhttp.responseText;
}
}
xmlhttp.open("GET", "getuser.php?q=" + str, true);
xmlhttp.send();
}
</script>
我还有另一个脚本,除了它叫做calcularCuotas(cuotas),最后几行是:
xmlhttp.open("GET", "getuser.php?c=" + str, true);
xmlhttp.send();
body 标签包含:
<select name="users" onchange="showUser(this.value)">
<select name="cuotas" onchange="calcularCuota(this.value)">
文件getuser.php
<?php
$q = $_GET["q"];
$c = $_GET["c"];
?>
当我尝试使用它时,php会抛出这个错误:
注意:未定义的索引:C:\wamp\www\Cotizacion\getuser.php 中第 3 行的 c
感谢您的帮助:)
【问题讨论】:
-
错误信息不明白怎么办?