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 April 1st, 2004, 11:22 AM
Pheeal Pheeal is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 7 Pheeal User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 14 m 2 sec
Reputation Power: 0
Unhappy Returning values...!

Right, here goes:

I need to return the value of a checkbox and perform a function or two using that value.

My checkbox(es) are call "chk0[]" and the value's are the ID of the same row, for example:

ID | Artist | Album | Genre | Record Label | Year | Rating | Delete
------------------------------------------------------------------------------------
001 Rem blah ... ... ... 4 [] (checkbox)
002 Incubus ..... ... ... .... 5 []
...etc

The checkbox name for the first checkbox is "001", second is "002" etc according to the value in the ID row.


So when an entry is checked and "Delete" is clicked, i need to compare the value of "chk0[]" (checkbox) with the elements in an array. I'm using "strstr" so if i refer to the checkbox - $id = ($_POST['chk0[$countvariable]']) does it return the value or simply "true" (if it is checked??).

I've tried changing several things but when I try to "strstr" the elements in the array it never returns a match, please help!


Many thanks, Phil

Reply With Quote
  #2  
Old April 5th, 2004, 09:08 PM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,890 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 14 m 9 sec
Reputation Power: 8
Checkboxes are tricky to deal with... they are only visible in the $_POST variable iwhen they're physically checked... meaning, if nothign is checked than $_POST('chk0') isn't set.

Is there a particular reason you've put square braces in your checkbox name? this may complicate things...
Perhaps you could try chkbox[0] instead of chkbox0[]...

Once doing so, you could use foreach ($_POST['chkbox'] as $chk)

Any help at all?

Reply With Quote
  #3  
Old April 8th, 2004, 01:28 PM
Pheeal Pheeal is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 7 Pheeal User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 14 m 2 sec
Reputation Power: 0
Lightbulb

It could help, but I'm using square brackets so that I can give each checkbox a name, which is the ID of the corresponding row. Then all I need to do is somehow return the VALUE of the checkbox and check for a match in the array. Then *hopefully* simply unset the element in the array, therefore deleting it, I hope.

Thanks for the suggestion, if my original idea doesnt work then I'll opt for yours

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > Returning values...!


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