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 June 11th, 2003, 02:59 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,886 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 19 m 35 sec
Reputation Power: 18
Forms... <Select multiple="multiple">

Sorry for the bad topic-line.... but its the best desc i could think...

The form contains this:

PHP Code:
<select name="genre" size="5" multiple="multiple" id="genre">
   <
option>[New Genre]</option>
   <
option>Industrial</option>
   <
option>Rock</option>
</
select



I made a quick script to show the POST variables...
PHP Code:
<?PHP 
  
foreach($HTTP_POST_VARS as $key => $value
   { 
     echo 
$key." = ".$value."<br>\n";
   }
?>



the POST variable shows the last selected item... for example, if i select all three, it returns "Rock"...

Any idea how i can retreive all selected items?

Reply With Quote
  #2  
Old June 11th, 2003, 04:06 PM
Taelo Taelo is offline
5B's
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: PC, FL
Posts: 366 Taelo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 30 m 59 sec
Reputation Power: 17
hmm,...maybe try something like this...
Code:
<select name="genre[]" size="5" multiple="multiple" id="genre">

you may be setting the value for genre to the last selected entry. by setting it as an array it should allow you to select and display multiple. give it a shot.
__________________
-- Jason

Reply With Quote
  #3  
Old June 11th, 2003, 04:09 PM
iahmed iahmed is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2003
Location: USA
Posts: 171 iahmed User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 42 m 58 sec
Reputation Power: 16
Following may give you a clue to your problem:
Cut and past following code to notepad and save as t1.php
And play with it. Thanks.


<html>
<body>
<?php
if (!$_POST['qry'])
{
?>
<form method=post action=t1.php>
<select MULTIPLE NAME="class[]">
<option>[New Genre]</option>
<option>Industrial</option>
<option>Rock</option>
</select>
<input type=submit name="qry">

<?PHP
} else {

$class=$_POST["class"];
echo $class[0]."<br>".$class[1]."<br>".$class[2];
}
?>
</form>
</body></html>

Reply With Quote
  #4  
Old June 11th, 2003, 05:48 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,886 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 19 m 35 sec
Reputation Power: 18
Thanks all...

i'll play around with it, I didn't realize you could put square brackets in the name attribute...

Reply With Quote
  #5  
Old June 11th, 2003, 08:52 PM
ben rowe ben rowe is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Posts: 24 ben rowe User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Heres a little tip:

You have the following code to go though your post array

PHP Code:
<?PHP 
  
foreach($HTTP_POST_VARS as $key => $value
   { 
     echo 
$key." = ".$value."<br>\n";
   }
?>


an easier way is to use the print_r() function

PHP Code:
 print_r($_POST); 

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > Forms... <Select multiple="multiple">


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 - 2018, Jelsoft Enterprises Ltd.

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