473,725 Members | 1,733 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Store list box values in database using an array

21 New Member
Hello friends ! ,

I am very new to java script.If anyone can help me then
I will be very very thankful to his/her.

I am using php and mysql in my project and I have one textarea and
one list boxes,now whenever user fill any value(email-Id) to textarea and press submit button then value going to listbox. These values are one or multiple , then they goes into list box , In list box these values are store in array .
I mean user insert any value(email-Id) to textarea seperated by comma or space. Then these are going to Listbox.... List Box values are store in database in form of array...
I am successfull to add & delete the value in listBox from textarea by using JavaScript ...But when I give array in list box for these values error comes. But when I dont use array for list box Error was not found ... And record goes into list box only....
But I can't fetch them with post or get method in php code to store in database.... I need your help, friends please help me to store list box values in databse By using array because these values are multiple ....

Ok !

Bye !
Nov 5 '07 #1
9 19840
acoder
16,027 Recognized Expert Moderator MVP
Welcome to TSDN!

I have changed the thread title to give it a better description. Please use a good thread title.

Post your code (using code tags please).
Nov 5 '07 #2
Ajinkya
21 New Member
Hello friends ! ,

I am very new to java script.If anyone can help me then
I will be very very thankful to his/her.

I am using php and mysql in my project and I have one textarea and
one list boxes,now whenever user fill any value(email-Id) to textarea and press submit button then value going to listbox. These values are one or multiple , then they goes into list box , In list box these values are store in array .
I mean user insert any value(email-Id) to textarea seperated by comma or space. Then these are going to Listbox.... List Box values are store in database in form of array...
I am successfull to add & delete the value in listBox from textarea by using JavaScript ...But when I give array in list box for these values error comes. But when I dont use array for list box Error was not found ... And record goes into list box only....
But I can't fetch them with post or get method in php code to store in database.... I need your help, friends please help me to store list box values in databse By using array because these values are multiple ....

Ok !

Bye !
Expand|Select|Wrap|Line Numbers
  1. <script language="javascript">
  2. function removeOptions(selectbox)
  3. {
  4. var i;
  5. for(i=selectbox.options.length-1;i>=0;i--)
  6. {
  7. if(selectbox.options[i].selected)
  8. selectbox.remove(i);
  9. }
  10. }
  11. function addOption_list(selectbox){
  12. var selval
  13.  
  14. selval=document.drop_list.AddEmail.value;
  15.  
  16. addOption(document.drop_list.invitation_who_email, selval,selval);
  17. selval=document.drop_list.AddEmail.value="";
  18. }
  19. </script>
Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <body>
  3. <select id="invitation_who_email[]"  multiple name="invitation_who_email[]"  size="30" >
  4. </select>&nbsp;&nbsp;&nbsp;<br>
  5. <input type="text" name="AddEmail">
  6.  
  7. </body>
  8. </html>
  9.  
  10.  
  11.  
Nov 13 '07 #3
acoder
16,027 Recognized Expert Moderator MVP
Give the list box an id of "invitation_who _email" and access the element using document.getEle mentById("invit ation_who_email ") instead.
Nov 13 '07 #4
Ajinkya
21 New Member
Give the list box an id of "invitation_who _email" and access the element using document.getEle mentById("invit ation_who_email ") instead.
Hello Sir !

Can you explain me in brief.....
Excuseme Sir, I want to store List box element in Database, these elements are multiple so I use array to store them in database. Sir, I use Javascript to add some text(value) in List box from textarea. But Sir, in front end I see values appears in List box but they dont get added as option values of List box. Sir and when I use array at that time error occured.
Sir , tell me any or give me any trics to add values in List box when user enter in textarea or text box which is single or multiple. If values are multiple then they are seperated by comma or white space, then they are differentiate in List Box... After it when I click submit button then these List Box values(multiple or single) will going to Database in the Form of string.
Thanks for your reply, Sir . Please think on my problem , do action on it and give me your very important suggesion !

Ok !

Bye !
Nov 15 '07 #5
acoder
16,027 Recognized Expert Moderator MVP
Put your form elements within form tags.

Your JavaScript code doesn't match with the HTML.

Your select element: [HTML]<select id="invitation_ who_email[]" multiple name="invitatio n_who_email[]" size="30" >[/HTML]should be [HTML]<select id="invitation_ who_email" multiple name="invitatio n_who_email[]" size="30" >[/HTML]and use document.getEle mentById("invit ation_who_email ") to refer to the form.
Nov 16 '07 #6
Ajinkya
21 New Member
Put your form elements within form tags.

Your JavaScript code doesn't match with the HTML.

Your select element: [HTML]<select id="invitation_ who_email[]" multiple name="invitatio n_who_email[]" size="30" >[/HTML]should be [HTML]<select id="invitation_ who_email" multiple name="invitatio n_who_email[]" size="30" >[/HTML]and use document.getEle mentById("invit ation_who_email ") to refer to the form.
Thak you Sir ! for your help ! I try this in my code !

ok !

Bye !
Nov 19 '07 #7
acoder
16,027 Recognized Expert Moderator MVP
No problem. Let us know how you get on.

PS. document.getEle mentById("invit ation_who_email ") would refer to the select element, not the form.
Nov 19 '07 #8
Ajinkya
21 New Member
Thak you Sir ! for your help ! I try this in my code !

ok !

Bye !
THANKS sir , I overcome this problem with the help of your code.....

Thank you Sir !!!

Ok !

Bye !
Nov 30 '07 #9
acoder
16,027 Recognized Expert Moderator MVP
THANKS sir , I overcome this problem with the help of your code.
Glad you got it working. Post again if you have any more questions.
Nov 30 '07 #10

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

Similar topics

5
7955
by: Jeffrey Silverman | last post by:
Hi, all. I have a linked list. I need an algorithm to create a tree structure from that list. Basically, I want to turn this: $list = array( array( 'id' => 'A', 'parent_id' => null, 'value' => 'aaa') , array( 'id' => 'B', 'parent_id' => 'A', 'value' => 'bbb') , array( 'id' => 'C', 'parent_id' => 'B', 'value' => 'ccc') , array( 'id' => 'D', 'parent_id' => 'A', 'value' => 'ddd')
4
2672
by: Christopher Brandsdal | last post by:
Hi! I have a delicatg problem.... I have made a registration form for adding my friends information in a database. The problem is that I want to connect the persons with companies in the same database. I wonder how i could connect a person to several other id's in a table. I wonder if I can make a string in the database that holds all the id's separated with , for example....?
11
2537
by: Colin Steadman | last post by:
Hope this makes sense! I'm building an ASP page which allows uses to add items to an invoice via a form, ie: Item No Part No Order No Quanity Units Price VAT ------- ------- -------- ------- ----- ----- --- .... ... ... ... ... ... ... <Add item> <Submit>
11
3611
by: hoopsho | last post by:
Hi Everyone, I am trying to write a program that does a few things very fast and with efficient use of memory... a) I need to parse a space-delimited file that is really large, upwards fo a million lines. b) I need to store the contents into a unique hash. c) I need to then sort the data on a specific field. d) I need to pull out certain fields and report them to the user.
10
5237
by: Peter Stojkovic | last post by:
I want store an integer-array of 1000 Values in a blob in a SQL-database. I will do this every 10 Seconds. How can I do this ???? What datatypes a have to use ??? Thanks
0
2909
by: cindy | last post by:
I have a dynamic datagrid. I have custom classes for the controls public class CreateEditItemTemplateDDL : ITemplate { DataTable dtBind; string strddlName; string strSelectedID; string strDataValueField; string strDataTextField; public CreateEditItemTemplateDDL(string DDLName,string DataValueField,string
20
24190
by: sruthini | last post by:
Hi, I am doing send some values(signup form::firstname,lastname,title,organization) to mail id using javamail at the same time it should store in database, my problem is how to fetch values from database and store it in array. I need urgently ,Please help me.
4
6497
by: TechnoAtif | last post by:
Hi ALL I have entered some array values using checkboxes into mysql database through a form. Next iam creating a searchpage where all those cateogories inserted through checkboxes has to be retrieved using list/menu box. When i check only a single checkbox to insert the checked category ,selecting that category through list box gives out the entire data of the user corresponding to that category. However when i check multiple checkboxes and...
3
6465
by: nady | last post by:
Dear Techies, I have a code which retrieves values from database cmdSelect = New OleDbCommand("select fields,finesFields from trafficReport where checked LIKE 1", conn) cmdSelectDr = cmdSelect.ExecuteReader While cmdSelectDr.Read MsgBox("Select " + cmdSelectDr(0) + cmdSelectDr(1) + " from fines") 'strtest = cmdSelectDr(0)
0
8872
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 usage, and What is the difference between ONU and Router. Letís take a closer look ! Part I. Meaning of...
0
8747
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9392
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9162
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
5997
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4505
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4773
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2619
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2150
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.