473,388 Members | 1,277 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

Store list box values in database using an array

21
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 19773
acoder
16,027 Expert Mod 8TB
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
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 Expert Mod 8TB
Give the list box an id of "invitation_who_email" and access the element using document.getElementById("invitation_who_email") instead.
Nov 13 '07 #4
Ajinkya
21
Give the list box an id of "invitation_who_email" and access the element using document.getElementById("invitation_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 Expert Mod 8TB
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="invitation_who_email[]" size="30" >[/HTML]should be [HTML]<select id="invitation_who_email" multiple name="invitation_who_email[]" size="30" >[/HTML]and use document.getElementById("invitation_who_email") to refer to the form.
Nov 16 '07 #6
Ajinkya
21
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="invitation_who_email[]" size="30" >[/HTML]should be [HTML]<select id="invitation_who_email" multiple name="invitation_who_email[]" size="30" >[/HTML]and use document.getElementById("invitation_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 Expert Mod 8TB
No problem. Let us know how you get on.

PS. document.getElementById("invitation_who_email") would refer to the select element, not the form.
Nov 19 '07 #8
Ajinkya
21
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 Expert Mod 8TB
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
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'...
4
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...
11
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 ------- ...
11
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...
10
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
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...
20
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...
4
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...
3
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 =...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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
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...

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.