I am building a web application in Ajax + Php.
Using Ajax, i would like to pass a javascript array containing some form values to a php script.
The script php then should get the array and access the array data.
But I cant get it working :p
I think I am doing something wrong in my js function...
Here is my form:
<script>var p = new Array()</script>
<form>
<b>Search Content:</b> <input type="text" name="p[]" onkeyup="control(p,'content_get2')">
<b>in</b>
<select name="p[]">
<? $misc->getSelectCategory(); ?> //fetch data in the db and build the select list
</select>
</form>
Here is my control function in my ajax.js
function control(p,action)
{
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
{
alert ("Browser does not support HTTP Request")
return
}
var url= "include/"+ action +".php"
url=url+"?p[]="+p
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=stateChanged
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}
And in my content_get2.php: $p = $_GET["p"];
Since I send my url+"?p[]="+p, i get an array, but its empty...
What do i do wrong?
Please help me!