473,385 Members | 1,325 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,385 software developers and data experts.

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 17 '05 #1
1 1955
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 17 '05 #2

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

Similar topics

1
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
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
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
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
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
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
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
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
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,...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.