Using checkbox with PHP and AJAX
Download this script here
This is a sample for you to get some Idea on making multiple selections Script Using PHP and AJAX technology.
I have tried to find multiple selection script by using checkbox that is not directly been processed on submit form. There are too many examples outside but almost not exactly
what I want. So create by myself and I want to share it with you.
You can test the demo script here:
Since I have created this script using PHP 4, it supposed not to come out with any major problem with PHP 5++
If You Feel Lucky with this code, Why not just buy me some coffee ![]()
Manual Instruction:
- Upload All Files into Your Server And Feel Good To Test And Modify.
Optional For PHP 5 User
- Edit the file getinfo.php into PHP 5 code that I have commented inside the code
Download this script here



February 13th, 2008 at 4:00 am
This doesn’t actually work. Even your demo fails!
February 13th, 2008 at 1:45 pm
You should check for your browser compatibality first. It works fine in my site.
It has been tested in Opera 9 And Microsoft Internet Explorer 7.
Make Sure Your Browser Support For Java Environment
July 18th, 2008 at 6:03 am
What the hell! It doesn’t work in my Mozilla 3. Hmm…
August 7th, 2008 at 5:51 pm
Doesn’t work for me either in FFox or IE – also, why use a button to get results? Click-to-see should be the goal with AJAX!
November 19th, 2008 at 7:44 pm
Hello,
I have completed an update to the script demo you provided to the world which works well with firefox. I would like to share it with you and others looking to play with a working copy of this demo. How can I best share this modified compressed package back to everyone.
Cheers,
Graham
November 21st, 2008 at 7:50 am
hello Graham
you can email it to me at abejali@yahoo.com so i will update the source code
Cheers,
Abejali
March 10th, 2009 at 8:55 pm
Hello Graham,
Can you please send me the scripts to this ID if you can ? I would aprreciate your help.
Thanks,
Maulik
March 10th, 2009 at 8:56 pm
thakermaulik@gmail.com ( Oops, I thought the ID would show up )
April 15th, 2009 at 12:30 am
Hi Graham could you email me the updated code as this example does not work
Regards
Thanks in advance
Paul
April 15th, 2009 at 12:31 am
Hi Graham could you email me the updated code as this example does not work
Regards
Thanks in advance
Paul
kmtclan@hotmail.com
April 28th, 2009 at 12:39 pm
Mate, I would get this tutorial to work properly or pull this tutorial down if I was you… it’s really not helping your mojo.
August 5th, 2009 at 4:48 pm
Your blog was of course amazing again even though it was terrifying for me to read what happened to you.You turned what could have been a very bad thing into something funny and positive. Do take care. Also your live radio news broadcast was also amazing.I love you xoxox
October 26th, 2009 at 12:22 pm
plz help me for use of using checkbox with php and ajax it doesn’t work ykjadeja2020 at g mail dot com
November 19th, 2009 at 8:47 pm
Can you please send me the code? I really need it. I tried a thousand other ones and none worked..
November 22nd, 2009 at 5:30 am
I have revised Back My code and it seem compatible with IE browser but not for most browser … So i have made some change on my code and will upload it in a short while … but for your reference.
please modify this for other browser compatibility. hope it works for you:
1-Change input name=”chkinfo[]” into name=”chkinfo” in index.html
2- Change function GetInfoString() in getinfo.js with this code
function GetInfoString(){
var sData="";
var iCount =0;
iCount = myform.elements.namedItem("chkinfo").length;
//==============================================================
if(iCount>>0){
for(i=0;i
// This Logic Is Compatible With IE browser but most not compatible for Other
//==============================================================
//if (myform.elements.namedItem("chkinfo[]","")(i).checked){
//sData += "&chkinfo[]=" + myform.elements.namedItem("chkinfo[]","")(i).value;
//}
//==============================================================
//Replace With This New Logic: has been Tested In IE And Chrome
//==============================================================
if (myform.chkinfo[i].checked) {
sData += "&chkinfo[]=" + myform.chkinfo[i].value;
}
}
}
return sData;
}
November 22nd, 2009 at 3:30 pm
Ok everybody .. i have upload the modified file .. please download it again if you having trouble with older version file.
November 22nd, 2009 at 3:45 pm
Hi Danny, I have updated the code and already upload it to server .. try to download it back and test. hopefully it will work for you and others
December 22nd, 2009 at 7:41 pm
Hi
Little bit change for more efficient
1 – Change input name=”chkinfo[]” into name=”chkinfo” in index.html
2-
function GetInfoString(){
var sData=”";
var iCount =0;
//iCount = myform.elements.namedItem(”chkinfo”).length;
var chk = document.getElementsByName(’chkinfo[]‘);
if(chk.length > 0){
for(i=0;i<chk.length;i++){
//===========================================================================
// This Logic Is Compatible With IE browser but most not compatible for Other
//===========================================================================
//if (myform.elements.namedItem("chkinfo[]","")(i).checked){
//sData += "&chkinfo[]=" + myform.elements.namedItem("chkinfo[]","")(i).value;
//}
//==============================================================
//Replace With This New Logic: has been Tested In IE And Chrome
//==============================================================
if (chk[i].checked == true) {
sData += "&chkinfo[]=" + chk[i].value;
}
}
}
return sData;
}
June 19th, 2010 at 9:53 pm
Useful site, where did you come up with the knowledge in this post? Im glad I found it though, ill be checking back soon to see what other articles you have.