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