473,569 Members | 2,383 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 2160
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
13209
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: Hunter_69. Here is what the form looks like. I have the difficulty of inserting the multiple items selected by the user the first time he visits and uses...
1
2577
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 access the recordset it displays the results, what the real issue is that the entry is not made into the database even though i use the Update...
2
2565
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> The above is an example of some data I am displaying in a form on an ASP page. I need to allow the users to edit any of the rows displayed and...
6
4278
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. Based on the number of variables passed through a GET string, I want to multiply the total number of selected items for each together to see how many...
9
2046
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 someone please review my before and after code and tell me the proper way to add transactions to my code? Thanks, TD
2
2906
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 paste them into another form. Your help is much appriciated. Thanks in advance, Greg.
8
7668
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) { if(MyBitmap != null) { Graphics g = e.Graphics;
5
3298
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
1379
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 => 1000 ) And i Have written the following to compute first the difference betwenn the element.However my reference array can only be compare from the...
5
13324
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 http://mghospedagem.com/images/controlpanel.jpg instead of http://mghospedagem.comhttp://mghospedagem.com/images/controlpanel.jpg As u see, there's the...
0
7703
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7926
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7982
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5514
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5222
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3656
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2116
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 we have to send another system
1
1226
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
944
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.