Running an Ajax script and the number of parameters i’m passing is dynamic. My parameter string is generated and sent to the PHP via the following function:
[CODE]function save(numStd){
//Find Selected Class
var all = document.all ? document.all :
document.getElementsByTagName(‘*’);
var elements = new Array();
for (var e = 0; e < all.length; e++)
if (all[e].className == ‘active’)
var currentClass=all[e].id;
var sendParams=escape(numStd)+”¶m1=”+escape(currentClass);
var paramCounter=2
for(var i = 1; i <= numStd; i++){
window[‘lNameSave’+i] = document.getElementById(“LastName”+i).value;
window[‘fNameSave’+i] = document.getElementById(“FirstName”+i).value;
window[‘ageSave’+i] = document.getElementById(“Age”+i).value;
sendParams =sendParams+”¶m”+paramCounter+”='”+escape(window[‘lNameSave’+i])+”‘”;
paramCounter++;
sendParams =sendParams+”¶m”+paramCounter+”='”+escape(window[‘fNameSave’+i])+”‘”;
paramCounter++;
sendParams=sendParams+”¶m”+paramCounter+”=”+escape(window[‘ageSave’+i]);
paramCounter++;
}
var urlNewStd = “/phpscripts/saveNewStd.php?param=”;
http.open(“GET”, urlNewStd + sendParams, true);
document.getElementById(“studentresult”).innerHTML=”<img src=’/images/ajax-loader.gif’ style=’margin:50px 0 0 110px;’/>”;
http.onreadystatechange = handleHttpResponseNewStd;
http.send(null);
}
if I input two records to send as parameters this is an example of what urlNewStd + sendParams looks like:
[CODE]/phpscripts/saveNewStd.php?param=2¶m1=4A¶m2=’Williams’¶m3=’Robin’¶m4=55¶m5=’Moore’¶m6=’Demi’¶m7=45
once it is in the PHP I can only access the first parameter which in the example would be “2”
any ideas?