General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old December 13th, 2003, 06:51 PM
thecharking thecharking is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 187 thecharking User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via AIM to thecharking
problem with checkboxes and arrays

alright so I need to make checkboxes which can be all selected with one check box. The checkboxes are made with a while{ statement, so they are not definite. I had been using this:

PHP Code:
//where the info is processed
function deleteCom()    {
  
$where join(','$_POST['deleteCom']);

  
$query mysql_query("DELETE FROM comments WHERE comid IN ($where);") or die(mysql_error());

//header("Location: index.php?page=comments&userid=" . $_GET['userid']);
    
}

//the select all checkbox and jscript
<script language=javascript>

function 
checkUncheckAll(oCheckbox) {

var 
el0bWhich oCheckbox.checkedoForm oCheckbox.form;

while (
el oForm[i++])

  if (
el.type == 'checkbox' && el.name.substr(0,9) == 'deleteCom'el.checked bWhich;

</script>

<p>

<input type='checkbox' id='checkAll' name='checkAll' onclick='checkUncheckAll(this);' title="Select or Deselect All Users">

<-- Select All

</p>

//i make the checkbox depending on security settings for user, and then it is echoed out...
$deleteBox = '<input name="deleteCom[]" type="checkbox" value="' . $comment['comid'] . '" title="Select Comment" />'; 

I tried this and when I click the select all box, only the first box is selected, and when I delete them, only the first message will be deleted! Why? It always worked before I thought.
thank you
__________________
hey it's the CHARKING

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > problem with checkboxes and arrays


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT