PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old January 3rd, 2000, 11:52 PM
Carolyn Carolyn is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 1999
Location: Fredericton, NB Canada
Posts: 1 Carolyn User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
If I choose more than one item in a checkbox list, PHP feeds back only the last choice. Why?

For example, I select 'dogs', 'cats' and 'mice', it sets the variable to 'mice' only.

Reply With Quote
  #2  
Old January 4th, 2000, 06:28 AM
PAV PAV is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 1999
Location: Netherlands
Posts: 77 PAV User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 14
You can put the results of all checked checkboxes in an array, let's say pets.

<input type="checkbox" name=pets[] value="dog">Dog
<input type="checkbox" name=pets[] value="cat">Cat
etc.

Only when a box is checked, PHP puts the value in the array pets[], starting with index 0.
Then you can read out all the checked values from the array.

Peter

Reply With Quote
  #3  
Old April 11th, 2000, 04:17 PM
acmearts acmearts is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2000
Posts: 4 acmearts User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I'm trying to get an array working with a dynamic multiple select box. I have put the rusults in an array but am unsure of how to explode the array on my action page.

If in the example below, someone selected both dog and cat, how could I send two emails to them. One about dogs and one about cats.

Reply With Quote
  #4  
Old April 12th, 2000, 07:20 PM
Dist Dist is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2000
Posts: 31 Dist User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 14
Here's something for both questions:
---
?>
<form>
Select:<br>
<select name="checks[]" size=5 multiple>
<option value="cats">Cats
<option value="dogs">Dogs
</select><br>

Checkboxes:<br>
<input type="checkbox" name="checks[]" value="dogs2">Dogs<br>
<input type="checkbox" name="checks[]" value="cats2">Cats<br>
</form>

<?

function send_mail_about($subject) {
print $subject . "<br>n";
}

while(list($dummy,$value)=@each($checks)) {
print send_mail_about($value);
}
---

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > processing checkboxes

Developer Shed Advertisers and Affiliates



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 | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap