473,320 Members | 1,535 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

PHP and JavaScript multiple delete check box

Well i'm having a problem with the compatibility of javascript and PHP multiple delete check box.. i used a javascript for the "CHECK ALL BOXES" just like yahoo mail.. so my input is something like this "<input type='checkbox' name='checkbox' value='1'><input type='checkbox' name='checkbox' value='2'>" and the check all boxes function worked but it doesnt work with my PHP code where it is something like this :
Expand|Select|Wrap|Line Numbers
  1. $checked = $_POST["checkbox"];
  2. for($i=0; $i < count($checked); $i++) {
  3. ....// DELETE ALL CHECKED
  4. }
[Please use CODE tags when posting source code. Thanks! --pbmods]

but if i change my input to something like:
Expand|Select|Wrap|Line Numbers
  1. <input type='checkbox' name='checkbox[]' value='1'><input type='checkbox' name='checkbox[]' value='2'>
.. it does work on my PHP script but it wont work for my "Check all Function" javascript.. **** it.. i need help!!!
Jun 20 '07 #1
4 14198
bonski
53
hello it205,

your name looks like a subject from a class.. just kidding... anyway.. can you show us your code..? so that, maybe we could contribute some lines on that..

you want it to look like this?



thanks..

bonski
Jun 20 '07 #2
ak1dnar
1,584 Expert 1GB
Well i'm having a problem with the compatibility of javascript and PHP multiple delete check box.. i used a javascript for the "CHECK ALL BOXES" just like yahoo mail.. so my input is something like this "<input type='checkbox' name='checkbox' value='1'><input type='checkbox' name='checkbox' value='2'>" and the check all boxes function worked but it doesnt work with my PHP code where it is something like this :
Expand|Select|Wrap|Line Numbers
  1. $checked = $_POST["checkbox"];
  2. for($i=0; $i < count($checked); $i++) {
  3. ....// DELETE ALL CHECKED
  4. }
but if i change my input to something like:
Expand|Select|Wrap|Line Numbers
  1. <input type='checkbox' name='checkbox[]' value='1'><input type='checkbox' name='checkbox[]' value='2'>
.. it does work on my PHP script but it wont work for my "Check all Function" javascript.. **** it.. i need help!!!
Its not that much clear acctually,are you planing to do something like this
Expand|Select|Wrap|Line Numbers
  1. <form action="delete.php" method="POST">
  2. <!--JS function related with a check box to select ALL check boxes goes here and Its working -->
  3. <input type='checkbox' name='checkbox[]' value='1'>
  4. <input type='checkbox' name='checkbox[]' value='2'>
  5. <input type='checkbox' name='checkbox[]' value='3'>
  6. <input type='checkbox' name='checkbox[]' value='4'>
  7. <input type="submit" value="Delete">
  8.   </form>
Now do you want to delete the selected checkboxes. ?
Jun 20 '07 #3
pbmods
5,821 Expert 4TB
Changed thread title to better describe the problem (did you know that threads whose titles contain phrases such as 'help with' actually get FEWER responses?).
Jun 20 '07 #4
Well i'm having a problem with the compatibility of javascript and PHP multiple delete check box.. i used a javascript for the "CHECK ALL BOXES" just like yahoo mail.. so my input is something like this "<input type='checkbox' name='checkbox' value='1'><input type='checkbox' name='checkbox' value='2'>" and the check all boxes function worked but it doesnt work with my PHP code where it is something like this :
Expand|Select|Wrap|Line Numbers
  1. $checked = $_POST["checkbox"];
  2. for($i=0; $i < count($checked); $i++) {
  3. ....// DELETE ALL CHECKED
  4. }
[Please use CODE tags when posting source code. Thanks! --pbmods]

but if i change my input to something like:
Expand|Select|Wrap|Line Numbers
  1. <input type='checkbox' name='checkbox[]' value='1'><input type='checkbox' name='checkbox[]' value='2'>
.. it does work on my PHP script but it wont work for my "Check all Function" javascript.. **** it.. i need help!!!

=====
This is what you can do:
Expand|Select|Wrap|Line Numbers
  1. function selectAll(flag){
  2.             var objCheckBoxes = document.forms["frmName"].elements["checkbox[]"];
  3.             if(!objCheckBoxes)
  4.                 return;
  5.             var countCheckBoxes = objCheckBoxes.length;
  6.             for(i=0;i<countCheckBoxes;i++){
  7.                 objCheckBoxes[i].checked = flag;
  8.             }
  9.         }
  10.  
Nov 15 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Greg | last post by:
I'm guessing the problem I'm having has something to do with Master Pages or DetailsView because the exact same code works fine on a page without a Master Page and DetailsView controls. The...
7
by: andrewfsears | last post by:
I have a question: I was wondering if it is possible to simulate the multiple constructors, like in Java (yes, I know that the languages are completely different)? Let's say that I have a class...
3
by: nigelesquire | last post by:
Please help! I'm trying to clone and delete multiple rows with JavaScript. I need two delete buttons that work...! I only have one for now, but it's not working properly, the output count is...
4
by: MoroccoIT | last post by:
Greetings - I saw somewhat similar code (pls see link below) that does mupltiple files upload. It works fine, but I wanted to populate the database with the same files that are uploaded to...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.