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 June 5th, 2000, 02:58 AM
RedEyes RedEyes is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2000
Posts: 13 RedEyes User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I need to process a form that has a multiple select drop down box in it ( <select name="statusselect" size="1" multiple> ). How do I process this in PHP so that I can see all of the options that the user chose?

Reply With Quote
  #2  
Old June 5th, 2000, 05:07 AM
Shiju Rajan's Avatar
Shiju Rajan Shiju Rajan is offline
.Net Developer
Dev Shed Novice (500 - 999 posts)
 
Join Date: Feb 2000
Location: London
Posts: 987 Shiju Rajan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 26 m 22 sec
Reputation Power: 14
Send a message via MSN to Shiju Rajan Send a message via Yahoo to Shiju Rajan
See,, once you submit your multiple drop down menu.the values will be passing separated with ",".

eg:
<select name="statusselect" size="5" multiple>
<option value="one">one</option>
<option value="two">one</option>
<option value="three">one</option>
</select>

the $statusselect variable will be holding a value "one,two". if i select one and two.

You can separate this value using explode() function.

$values=explode(",",$statusselect);
// this returns an array of strings containing the elements.

then you can simply play around this array
($values).

Hope this may help you to sort out your problem.




------------------
SR -
shiju.dreamcenter.net

"The fear of the LORD is the beginning of knowledge..."

Reply With Quote
  #3  
Old June 5th, 2000, 03:05 PM
RedEyes RedEyes is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2000
Posts: 13 RedEyes User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I've tried that but all that gets passed to my php program is the last value that I select from the multiple box. The multiple box I'm using is as follows:

<select name="statusselect" size="1" multiple>
<option value="All" selected>All</option>
<option value="Cancelled">Cancelled</option>
<option value="Completed">Completed</option>
<option value="In Progress">In Progress</option>
<option value="On Hold">On Hold</option>
<option value="Proofing">Proofing</option>
</select>

When I select "Cancelled" and "In Progress" the statusselect variable only contain "In Progress".

I'm using IE - does this make a difference?


Reply With Quote
  #4  
Old June 5th, 2000, 04:53 PM
ujludwig ujludwig is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2000
Posts: 63 ujludwig User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 14
Try treating the select variable like an array. That's how I process my lists.

Sidenote: I had problems like you until I put the processing into a function to which the select varaible was actually passed.... e.g. pass the variable to a function before you access it.

Reply With Quote
  #5  
Old June 6th, 2000, 01:53 AM
Shiju Rajan's Avatar
Shiju Rajan Shiju Rajan is offline
.Net Developer
Dev Shed Novice (500 - 999 posts)
 
Join Date: Feb 2000
Location: London
Posts: 987 Shiju Rajan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 26 m 22 sec
Reputation Power: 14
Send a message via MSN to Shiju Rajan Send a message via Yahoo to Shiju Rajan

Try treating the select variable like an array. That's how I process my lists.


yes,
you can do that .

just try the following..

<select name="statusselect[]" size="5" multiple>
<option value="All" selected>All</option>
<option value="Cancelled">Cancelled</option>
<option value="Completed">Completed</option>
<option value="In Progress">In Progress</option>
<option value="On Hold">On Hold</option>
<option value="Proofing">Proofing</option>
</select>


Retrieve the value like following..

<?php

$count=count($statusselect);

for ($a=0; $a<$count; $a++) {
echo $statusselect[$a];
}
?>



------------------
SR -
shiju.dreamcenter.net

"The fear of the LORD is the beginning of knowledge..."

Reply With Quote
  #6  
Old June 8th, 2000, 01:44 AM
RedEyes RedEyes is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2000
Posts: 13 RedEyes User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I spotted my problem - I had not included the [] characters after the variable name. Now it works like a dream.

Thanks for your help guys.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > Multiple drop down box selects

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