PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Mon Feb 24, 2020 9:09 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 10 posts ] 
Author Message
PostPosted: Tue May 07, 2002 6:27 pm 
Offline
Forum Contributor

Joined: Thu May 02, 2002 11:51 am
Posts: 101
Location: New Mexico, USA


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 07, 2002 8:09 pm 
Offline
Forum Contributor
User avatar

Joined: Sat Apr 20, 2002 10:47 am
Posts: 118
Location: East Coast
concidering there is sytax errors with your for loop:
correct:
for($i = 0; $i < $num_rows; $i++)
{
statements
}


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 07, 2002 8:52 pm 
Offline
Forum Contributor

Joined: Thu May 02, 2002 11:51 am
Posts: 101
Location: New Mexico, USA
the loop works as is, I am able to loop thru the other form elements and have them update. Its just the checkboxes that don't update.


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 08, 2002 12:22 am 
Offline
Forum Contributor

Joined: Sun Apr 28, 2002 9:52 pm
Posts: 122
Location: Portsmouth, VA
fatal, $i++ and ++$i will do the same thing.

but dsm, everything seems to check out ok from what you posted..is there any other parts of the code that deals with 'display'


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 08, 2002 10:56 am 
Offline
Forum Contributor
User avatar

Joined: Sat Apr 20, 2002 10:47 am
Posts: 118
Location: East Coast


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 08, 2002 11:05 am 
Offline
Forum Contributor

Joined: Thu May 02, 2002 11:51 am
Posts: 101
Location: New Mexico, USA


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 08, 2002 11:27 am 
Offline
Forum Contributor

Joined: Sun Apr 28, 2002 9:52 pm
Posts: 122
Location: Portsmouth, VA
ahh i see what you're saying now, when you use blah[] in your input fields it only pushes the array, so:

<input type="checkbox" name="blah[]">
<input type="checkbox" name="blah[]">

if you check both boxes, it will be: array('0'=>'on','1'=>'on')
if you check the first OR the second: array('0'=>'on')

it doesn't skip an int for the unused checkboxes.


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 08, 2002 12:00 pm 
Offline
Forum Contributor

Joined: Thu May 02, 2002 11:51 am
Posts: 101
Location: New Mexico, USA
YUP 8O


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 09, 2002 3:42 am 
Offline
Forum Regular
User avatar

Joined: Fri May 03, 2002 3:33 am
Posts: 512
Location: Edinburgh, Scotland
Hi,

I have done something similar in the past. I gave each checkbox a unique name i.e.

<input type="checkbox" name="chk-faq1">
<input type="checkbox" name="chk-faq2"> etc.

When the form gets posted I looped through the $HTTP_POST_VARS array (I think that is what its called), I used the pos function to determine if 'chk' was at the beginning of the field name (to distinguish from other fields) then use the explode function to passing '-' as the separator which gave me 'faq1' in $myexplodedarray[1] etc.

Hope I have explained it well enough, I can probably post a bit of sample code if you need it.

Mike


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 09, 2002 10:34 am 
Offline
Forum Contributor

Joined: Sun Apr 28, 2002 9:52 pm
Posts: 122
Location: Portsmouth, VA


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group