By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,159 Members | 1,941 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,159 IT Pros & Developers. It's quick & easy.

adding list items to a database

P: n/a
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
Share this Question
Share on Google+
1 Reply


P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.