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

Home Posts Topics Members FAQ

adding list items to a database

Not sure if this is javascript or php so i put it in both newsgroups, sorry
if it's the wrong group.

I wrote (with help) a code to put several items in a list object (select)
and I would like to add the items in this list to a database.

I know how to add a selected item to the database but how can i put al the
items tot the database. I need somekind of loop wich go's through the list.

Any suggestions
roy
Jul 23 '05 #1
1 1531
R.G. Vervoort wrote:
Not sure if this is javascript or php so i put it in both newsgroups, sorry
if it's the wrong group.

I wrote (with help) a code to put several items in a list object (select)
and I would like to add the items in this list to a database.

I know how to add a selected item to the database but how can i put al the
items tot the database. I need somekind of loop wich go's through the list.

Any suggestions
roy


Its a PHP issue... javascript will only make changes to the client (web
browser) whereas PHP is server based.

Your form has its contents written to $_POST so you can loop through its
contents with

<?
foreach($_POST as $key=>$value)
{ print("<br>$key = $value"); }
?>

You should ensure your data is clean before writing to the database - if
you don't you risk someone putting data in to the form that could give
them access to removing one or more files from your system by simply
having data input using hooks (`) or backslashes.

Download and view the php guide from php.net - I use it all the time and
its pretty good both as a function reference and it has some examples.

I suggest you buy a good book (I have Core PHP by Leon Atkinson for PHP
4 and more recently version 5 and its excellent) and also keep a close
eye on comp.lang.php as there is good help there.

regards
randelld
Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1961
by: R.G. Vervoort | last post by:
Not sure if this is javascript or php so i put it in both newsgroups, sorry if it's the wrong group. I wrote (with help) a code to put several items in a list object (select) and I would like to...
1
1342
by: clarket | last post by:
Hi, Is there any easy way of adding an item to a html list (or does this need to be done server side). What I want to do is have a list wirh about 10 items in it, if the item the user wants to...
2
1450
by: estafford | last post by:
I have a dropdownlist control that is filled using a database query. I also want to add an additional option to the list that is not pulled from the database. How can I go about doing that? ...
26
2795
by: Simon Jefferies | last post by:
Hello, I am trying to add an item to a checked list box, like: clbList.Items.add("Hello",true) I get an error back: Run-time exception thrown: System.ArgumentOutOfRangeException -...
15
3076
by: glenn | last post by:
Hi folks, I have a DropDownList in a DataGrid that is populated from records in a database. I want to add a value that might be a string such as "Select a Company" for the first item since an...
14
18633
by: Paul_Madden via DotNetMonster.com | last post by:
Basically I have a listbox to which I add simple STRING items- I have a progress bar which I increment whenever I populate another portion of the complete set of items I wish to add. What I observe...
9
4467
by: Kadett | last post by:
Hi all, I have following problem: I'm creating a ListView (Details) control at run-time and filling it with some records (let's say 10 000). This operation seems to be quite fast, but when I call...
0
1886
by: marcobx | last post by:
I have a ComboBox and a List of objects to popolate items. I use the DataSource property and not the List collection: List<foolst = new List<foo>; //add elements into the list //......
3
2235
by: laurasaur | last post by:
Hi everyone, I have 2 listboxes that I need to move items between, they are both bound to DataTables which get populated from the database with a list of clients. Im getting a few problems,...
2
2958
by: =?Utf-8?B?TWFobW91ZCBTaGFiYW4=?= | last post by:
i have a problem in adding new listbox items i don't need to allow adding multible items with the same textvalue ex: if current items are: green red
0
7225
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
7124
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
7385
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...
0
7498
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...
1
5053
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...
0
3182
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1558
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
766
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
418
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...

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.