From: Astrid Hexsel <ahexse01@postoffice.csu.edu.au>
To: pgsql-sql@postgresql.org
Subject: insert value of form - checkboxes
Date: Thu, 9 Nov 2000 19:05:46 +1100
Message-ID: <3a0a5ada.2ef3.0@postoffice.csu.edu.au> (raw)
Hello all,
I have a form which has got checkboxes and I am having problems to have their
values stored in different rows of a table.
What I have done is:
# colour_id is the name of my checkboxes in the input tag
<input type=checkbox name=colour_id value=200>
<input type=checkbox name=colour_id value=201>
etc ...
# I put all the values into the array and split them
$colour = $formdata{'colour_id'};
@colours = split (/,/, $colour);
#then I want to insert then into a table (called cart)in the row called colour_id.
If I have more than one value they have to be in different rows.
# my code:
foreach $colour(@colours)
{
$qry = INSERT INTO cart VALUES
('$session_id', '$range_id', '$colour')
}
And what happens is that I am only getting just
one value now inserted in the row. If for example I checked 3 boxes I will get
only the last
one.
The foreach loop works fine out of the query.
Thanks a lot for any help.
Astrid
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: ahexse01@postoffice.csu.edu.au
Subject: Re: insert value of form - checkboxes
In-Reply-To: <3a0a5ada.2ef3.0@postoffice.csu.edu.au>
References: <3a0a5ada.2ef3.0@postoffice.csu.edu.au>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox