473,508 Members | 2,168 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Having trouble with Multiple Select box in form processor.

2 New Member
My form processor is giving me a bit of trouble for some unknown reason. I was sure I had both my form and my processor correctly scripted. I am pretty new to this though. All of the fields except for the multiple select box are functioning properly. If anyone could help me with this, I'd really appreciate it. The page where the form is located can be found HERE

Here is the script for my multiple select box in my form:

Expand|Select|Wrap|Line Numbers
  1. <span style="font-style: italic">Hold
  2. CTRL
  3. for
  4. multiple
  5. selections</span><br />
  6. <label for="open_slots[]"></label>
  7. <select name="open_slots[]" size="6" multiple="multiple" id="open_slots[]">
  8.   <option value="Monday 2a-6a">Monday  2a-6a</option>
  9.   <option value="Tuesday 2a-6a">Tuesday  2a-6a</option>
  10.   <option value="Wednesday 2a-6a">Wednesday  2a-6a</option>
  11.   <option value="Thursday 2a-6a">Thursday  2a-6a</option>
  12.   <option value="Friday 2a-6a">Friday  2a-6a</option>
  13.   <option value="Saturday 2a-8a">Saturday  2a-8a</option>
  14.   <option value="Sunday 2a-8a">Sunday  2a-8a</option>
  15.   <option value="Monday 10a-2p">Monday  10a-2p</option>
  16.   <option value="Tuesday 10a-2p">Tuesday  10a-2p</option>
  17.   <option value="Wednesday 10a-2p">Wednesday  10a-2p</option>
  18.   <option value="Thursday 10a-2p">Thursday  10a-2p</option>
  19.   <option value="Friday 10a-2p">Friday  10a-2p</option>
  20.   <option value="Saturday 3p-7p">Saturday  3p-7p</option>
  21.   <option value="Sunday 3p-7p">Sunday  3p-7p</option>
  22.   <option value="Monday 2p-6p">Monday  2p-6p</option>
  23.   <option value="Tuesday 2p-6p">Tuesday  2p-6p</option>
  24.   <option value="Wednesday 2p-6p">Wednesday  2p-6p</option>
  25.   <option value="Thursday 2p-6p">Thursday  2p-6p</option>
  26.   <option value="Friday 2p-6p">Friday  2p-6p</option>
  27.   <option value="Saturday 7p-10">Saturday  7p-10</option>
  28.   <option value="Sunday 7p-10">Sunday  7p-10</option>
  29.   <option value="Monday 6p-10p">Monday  6p-10p</option>
  30.   <option value="Tuesday 8p-2a">Tuesday  8p-2a</option>
  31.   <option value="Wednesday 6p-10p">Wednesday  6p-10p</option>
  32.   <option value="Thursday 8p-2a">Thursday  8p-2a</option>
  33.   <option value="Friday 6p-10p">Friday  6p-10p</option>
  34.   <option value="Saturday 10p-2a">Saturday  10p-2a</option>
  35.   <option value="Sunday 10p-2a">Sunday  10p-2a</option>
  36.   <option value="Monday 10p-2a">Monday  10p-2a</option>
  37.   <option value="Wednesday 10p-2a">Wednesday  10p-2a</option>
  38.   <option value="Friday 10p-2a">Friday  10p-2a</option>
  39. </select>
  40. <br />
Here is my processor script:

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. $ToEmail = 'user@example.com';
  3. $ToSubject  = 'NEW DJ APPLICATION from WWRN Webpage';
  4.  
  5. $email = $_POST['email'];
  6. $fullname = $_POST['fullname'];
  7. $phone = $_POST['phone'];
  8. $website = $_POST['website'];
  9. $position = $_POST['position'];
  10. $resume = $_POST['resume'];
  11. $prior_experience = $_POST['prior_experience'];
  12. $broadband = $_POST['broadband'];
  13. $startdate = $_POST['startdate'];
  14. $work_sample = $_POST['work_sample'];
  15. $show_name = $_POST['show_name'];
  16. $cohost = $_POST['cohost'];
  17. $website = $_POST['website'];
  18. $open_slots = $_POST['open_slots'];
  19.  
  20.  
  21. $EmailBody =   "Email: $email\n
  22. Name: $fullname\n
  23. Phone: $phone\n
  24. Website: $website\n
  25. Position Applying For: $position\n
  26. Resume: $resume\n
  27. Prior Experience: $prior_experience\n
  28. Broadband: $broadband\n
  29. Start Date: $startdate\n
  30. Link to Sample of Work: $work_sample\n
  31. Desired Show Name: $show_name\n
  32. Co-Hosts/DJs: $cohost\n
  33. Desired Open Slot: $open_slots\n";
  34.  
  35. $Message = $EmailBody;
  36.  
  37.  
  38. $headers .= "Content-type: text; charset=utf-8\r\n";
  39. $headers .= "From:".$email."\r\n";
  40.  
  41. mail($ToEmail,$ToSubject,$Message, $headers);
  42.  
  43. /* Resulrs rendered as HTML */
  44.  
Whenever the form gets processed, all of the enter text fields and radio buttons come through just fine. But the selections from my multi-select box are only returned as "Array." I don't see where I went wrong. Can you tell me how to fix this, please?
Mar 12 '10 #1
3 2156
Atli
5,058 Recognized Expert Expert
Hey.

That is because the values selected in a multi-select box are returned as an array, and when you try to print an array as a string, it simply prints "Array".

What you need to do is create a string from the array values and print that. The implode function can help there.
Expand|Select|Wrap|Line Numbers
  1. $open_slots_str = implode(', ', $open_slots);
  2. echo $open_slots_str;
  3. // Prints something like:
  4. //  First value, Second value, Third value
Mar 12 '10 #2
kipthemann
2 New Member
Thank you. That was all that I needed. You really know your stuff. I nixed the "echo $open_slots;" because I don't need that info showing up in my results page and it works perfectly. I really appreciate your help. This has saved me a lot trouble and headache. I've been working on this form for the past 3 days. I don't have a lot of money to spare but I figure since you did this for free that I'd be willing to make a donation to your PP account. Just PM me if you're interested. Thanks again.
Mar 12 '10 #3
danfo
1 New Member
This solved my problem too! I knew it had to be a simple fix.... thanks a TON!
May 24 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
13206
by: jason | last post by:
How does one loop through the contents of a form complicated by dynamic construction of checkboxes which are assigned a 'model' and 'listingID' to the NAME field on the fly in this syntax:...
1
2574
by: Anand | last post by:
Hi i am having trouble adding a recordset into the access database, the code seems to be working fine it passs and parses through all variables just fine without showing any errors and also when i...
2
2561
by: Colin Steadman | last post by:
Part No Description Quantity 45643 Random part 10 45678 Another Random part 7 98944 And another 1 <submit button> ...
6
4270
by: Ben Hallert | last post by:
Hi guys, I'm trying to figure out what bone headed mistake I made on something I put together. I've got a form (named 'context') that has a variable number of select-multiple inputs on it. ...
9
2034
by: TD | last post by:
I am trying to add transactions to my code. The original code worked fine until I followed an example to setup transactions, now the code does strange things, but no error messages. Could...
2
2898
by: Greg | last post by:
Hi all, Is there a way to copy multiple objects into the clipboard and then paste them? What I want to achive is to be able to copy UI controls (textedits, dropdowns, etc) from one form and...
8
7662
by: Flack | last post by:
Hey guys, In my app I have a bitmap where drawing is done and in the form's paint method I show the bitmap: private void Form1_Paint(object sender, System.Windows.Forms.PaintEventArgs e) {...
5
3293
by: Max | last post by:
Is there any way to set a select-multiple type <select multiple="multiple"with multiple selected options in scripting? Any idea about this is appreciative.
5
1377
by: poreko | last post by:
Hi guys I am trying to compare every row of mysql database against an array. My aim is to compute the euclidean distance. This is my reference array: Array ( => 2.5 => 120 => 128 => 2 =>...
5
13304
matheussousuke
by: matheussousuke | last post by:
Hello, I'm using tiny MCE plugin on my oscommerce and it is inserting my website URL when I use insert image function in the emails. The goal is: Make it send the email with the URL...
0
7127
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7331
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7391
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7054
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7501
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5633
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3204
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1564
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
768
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.