hello again, russ gave me a wonderful tip, but now i'm standing in front of the next problem: if i try to insert these values out of the array into the table of the db, i probably don't know the correct way. this is how i tried it: /* this works fine! */ foreach($werbeform as $key=>$val) { echo "<p><b>$key: </b>" . "$val</p>"; }
/* but this doesn't get the data into the db_table called 'werbe': */ $anfrage_werbe=foreach($werbeform as $key=>$val) { "INSERT INTO werbe (id_main,werbeform) VALUES ('$id','$val')"; }; can anybody tell me what i'm doing wrong? the values of the checkboxes should be added to the db-table each as a new line, e.g. not all into one field. -----Ursprungliche Nachricht----- Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]Im Auftrag von Russ Michell Gesendet: Dienstag, 11. Dezember 2001 12:24 An: es said Cc: [EMAIL PROTECTED] Betreff: Re: [PHP-DB] how to access checkboxes & get them into database I don't think you need to get into global variables unless you *really* need to. In this case it sounds as if you don't. OK so you have an array of checked values, so what's next? You wanna get those variables outta that array in your process script, and perform whatever it is you want (inserts, updates etc) upon those variables. so: foreach($array as $key=>$val) { echo "<p><b>$key: </b>" . "$val</p>"; } This will echo the array's keys (labels, whatever) and their associated values to the page. (just so you can see what's going on) You can now use these vars ($key and $val) to perform your DB inserts updates etc. I hope that was of use to you. Regards: Russ On Tue, 11 Dec 2001 12:14:01 +0100 es said <[EMAIL PROTECTED]> wrote: > hi there, > this time i've got another problem with my set of database-tables: > i created a database (containing 6 tables) and some html-sheets for the in- > and output. so far, so good. > some values should be added to ONE of those tables table by checking > checkboxes in a form. > okay, the checked values of the checkboxes go into an array, which is given > to the processing php-sheet as globals, but furtheri don't get yet. > can someone please help me? > all thanx !!! > cornelia > "Believe nothing - consider everything" Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam www.theruss.com