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:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old February 12th, 2003, 10:51 AM
baddogg99 baddogg99 is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Location: GA, USA
Posts: 19 baddogg99 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
select box List questions

I have a form that has a multiple selct box on it. I want to insert the values of each option selected into the database seperately.

Does this get passed to the next page as a comma delim list (as it does in Cold Fusion, which I am used to)?

What functions should I be learning about? Does anyone have specific code example I can reference?

Thanks for the patience while I learn!

Brant

Reply With Quote
  #2  
Old February 12th, 2003, 11:26 AM
ramz ramz is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Location: Juiz de Fora - MG- Brazil
Posts: 93 ramz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via ICQ to ramz Send a message via MSN to ramz
Hi!
You can name it as an array, for example:

<select name="mySelect[]">
<option value="first">First</option>
<option value="second">Second</option>
<option value="third">Third</option>
<option value="forth">Forth</option>
</select>

In PHP use this:

<?php
$howmany = count($mySelect);
if($howmany > 1) {
for($i = 0; $i < $howmany; $i++) {
$sql = "INSERT INTO table VALUES ('" . $mySelect[$i] . "')";
}
} else {
$sql = "INSERT INTO table VALUES ('" . $mySelect[0] . "')";
}
?>
__________________
Regards,
Ramiro Varandas Jr.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > select box List questions


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