<div class="grid--cell fl1 lh-lg">
<div class="grid--cell fl1 lh-lg">
This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, <a href="/help/reopen-questions">visit the help center</a>.
</div>
</div>
</div>
<div class="grid--cell mb0 mt8">Closed <span title="2013-04-10 16:20:13Z" class="relativetime">7 years ago</span>.</div>
</div>
</aside>
I have this php that uses ajax
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>
I have another script as above, except that it is called calcularCuotas(cuotas) and the last lines are:
xmlhttp.open("GET", "getuser.php?c=" + str, true);
xmlhttp.send();
The body tag contains:
<select name="users" onchange="showUser(this.value)">
<select name="cuotas" onchange="calcularCuota(this.value)">
The file getuser.php
<?php
$q = $_GET["q"];
$c = $_GET["c"];
?>
When I try to use it, php throws this error:
Notice: Undefined index: c in C:\wamp\www\Cotizacion\getuser.php on line 3
Thanks for help :)
</div>
In your first code block i.e cotizaciones.php
xmlhttp.open("GET", "getuser.php?q=" + str, true);
it does not contain c as querystring hence you get error undefined index c
Use Ajax library of Jquery it's just an advice.