SunQuest
           PHP Coding
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsPHP RelatedPHP Coding

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 Codewalkers Forums Sponsor:
AT&T devCentral & BlackBerry(r) Webcast Series: BlackBerry and GPS -Build Location Awareness into your BlackBerry Applications, July 10th-1:00PM EST. Register Today!
  #1  
Old October 4th, 2002, 03:08 AM
madhombre madhombre is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: WI
Posts: 247 madhombre User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
dealing with multiple select boxes and $_POST

ok folks, grabbing stuff out of $_POST and then I come to the multiple select boxes I have

In the array for $_POST it just says Select as the key and no as the value (the value of the last select) my question is how the heck do I get the rest? I thought that the value might return as an array so I tried to print_r that, got nothing useful.

So how do I pull the select values out of the $_POST????

Reply With Quote
  #2  
Old October 4th, 2002, 11:02 AM
Matt Matt is offline
Moderator
Codewalkers Specialist (4000 - 4499 posts)
 
Join Date: Apr 2007
Location: Florida
Posts: 4,158 Matt User rank is Private First Class (20 - 50 Reputation Level)Matt User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 h 10 m 20 sec
Reputation Power: 6
RE: dealing with multiple select boxes and $_POST

You can name each select box:

<SELECT name="something">
<OPTION value="yes">Yes</OPTION>
<OPTION value="no">No</OPTION
</SELECT>

you would then address that select box as $_POST['something']

You can also try naming them as an array, I haven't tried it but it should work:

<SELECT name="something[]">
<OPTION value="yes">Yes</OPTION>
<OPTION value="no">No</OPTION
</SELECT>
<SELECT name="something[]">
<OPTION value="yes">Yes</OPTION>
<OPTION value="no">No</OPTION
</SELECT>

you should then be able to loop through:

foreach($_POST['something'] as $something) {
echo $something;
}

Reply With Quote
  #3  
Old October 4th, 2002, 03:42 PM
madhombre madhombre is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: WI
Posts: 247 madhombre User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: dealing with multiple select boxes and $_POST

DOH!!!!

you know the only time I get to code is a time when sadly I am constantly interrupted.

I thought I WAS naming my selects with the field name but sadly I was just calling them all Select.

I am sorry I didn't see this sooner.

Thanks for helping me spot my mistake.

Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP RelatedPHP Coding > dealing with multiple select boxes and $_POST


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 6 hosted by Hostway