Jump to content
webgyrl

Select Multiple In Html Form Not Working

Recommended Posts

Hi All!

 

I'm designing an HTML form and I am trying to make it so that a user can select multiple answers in a drop down list. The code I have is this:

 

> <tr valign="top">
  <td width="70%" align="right">14.) FRESH Consultants offers Mobile Bookkeeping Services to small businesses. In your opinion, which of these services would help in the growth of your business if contracted to FRESH Consultants? <span class="style3">(Please CTRL or CMD and click on each one that applies to you)</span></td>
  <td width="40%" align="left"><SELECT NAME="MBS-Services-of-Interest" MULTIPLE SIZE=6 id="MBS-Services-of-Interest">
	<option selected="selected">Select all that apply
	  <option value="Bookkeeping & Accounting Services">Bookkeeping & Accounting Services 
	  <option value="Payroll Services">Payroll Services 
	  <option value="Tax Services">Tax Services 
	  <option value="Training Services">Training Services 
	  <option value="Financial Analysis">Financial Analysis 
	  <option value="Advisory Services">Advisory Services 
	  </SELECT>	</td>
</tr>

 

 

When the form is sent, I am only getting ONE result back:

Mbs Services Of Interest: Training Services

 

I have no idea why this is happening. I tried to also use checkboxes, but same thing, only one item checked is being delivered to me.

 

Any ideas why it's not sending multiple selections?

 

Also, another little thing... I have set the thanks.php to refresh to the home page after form submission. It works in Firefox, but not in IE7? Here is the code I used:

 

><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta HTTP-EQUIV="REFRESH" CONTENT="3; URL=java script:window.open('http://www[dot]domainname[dot]com','_top');">
<title>MBS Survey</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

 

Why would it refresh in FF but not in IE?

 

Livesite is here:

freshconsultants[dot]com

 

Thanks for any insight you may have!

Share this post


Link to post
Share on other sites

I sorted out the refresh deal. I used one sort of JS to do it that didn't seem to include the JS code. It had worked in FF, but there was a conflict in IE, so I ended up using the following and including the JS in the page to solve the issue:

><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="refresh" content="4;url=http://www.freshconsultants.com" target="_top"> 
<title>MBS Survey</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script LANGUAGE="javascript">
<!--
if (top.location != location) top.location.href = location.href;
//---> </SCRIPT>

 

Still can't figure out the list multiples issue tho! :)

Edited by webgyrl

Share this post


Link to post
Share on other sites

I am not sure whether this will work but try naming your select MBS-Services-of-Interest[]

 

With the square brackets at the end

 

then when it has posted it might be an array which you can run through each option selected.

Share this post


Link to post
Share on other sites
I am not sure whether this will work but try naming your select MBS-Services-of-Interest[]

 

With the square brackets at the end

 

then when it has posted it might be an array which you can run through each option selected.

 

Wow, that worked! Can you explain to me why it worked?

Share this post


Link to post
Share on other sites

Sure

 

By adding [] to the end of the name you are not creating a single element called MBS-Services-of-Interest anymore, you are creating an array called MBS-Services-of-Interest

 

So when you were selecting multiple options before if would only be able to store one of them as MBS-Services-of-Interest and would overwrite any other selections, now instead it can store as many elements as you require..

 

so it will be

MBS-Services-of-Interest[0] = 'first choice'

MBS-Services-of-Interest[1] = 'second choice'

and so on...

Share this post


Link to post
Share on other sites

Ah OK, that's very interesting. I thought for some reason that the form script I bought would already have that all programmed into it. I think I'll tell the developer about this as I'm sure I'm not the first to encounter it. Thanks so much for explaining it to me. At least now I know how to do an HTML array. Thanks!

Share this post


Link to post
Share on other sites

Thank you so much!

 

Hey Andy... I got your reply... and I see you down there... hope you are well. Have a super day.... I'm off to bed! LOL

Share this post


Link to post
Share on other sites

I'm fine thanks Nat, OJB had it covered and posted just before me, hence I deleted my reply. I'm glad you have it all sorted :tchrocks:

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...