On Monday 06 December 2004 20:39, Stuart Felenstein wrote:
> --- Jason Wong <[EMAIL PROTECTED]> wrote:
> > I'm not sure what you mean exactly by "intended use
> > checkboxes".
>
> Intended use - I generate a list (via a repeat region)
> of records. Each item on the list has an associated
> checkbox. If I put a check in the box, do a $_POST I
> expect on the next page where I"ve set up the correct
> parameters, to see the selected record only.
OK, so your intended use is to "see the selected record(s?)" (based on the
checkboxes selected). Now your problem is not with the "see selected record"
bit (I'm pretty sure you've got that sussed out), it is with "how do I handle
checkboxes". See below.
> Probably, but then again all questions posted here
> could be derived from the manual.
I would guess that 80% of the questions on the list could be answered with
_direct_ reference to the manual(s). By direct reference I mean either
searching the manual for the 1 or 2 _obvious_ keywords or looking in the
_obvious_ section of the manual. For example, some people have asked "how do
I escape strings before inserting them into a mysql database", well one of
the obvious place would be to look at the mysql section of the php manual,
and if the asker had done that they would have seen that there are functions
called mysql_real_escape_string() and mysql_escape_string(). That's why
people should RTFM first, before even thinking of posting to the list!
Anyway ...
> So I set the value of the check box to:
> <th height="38" scope="row"><input type="checkbox"
> name="checkbox" value="<?php echo
> $rsRes->Fields('Rese'); ?>"></th>
... there's your problem, all your checkboxes have the same name. PHP is not
smart enough to automatically put them into an array, so if you check more
than one checkbox PHP will either keep the first checkbox or the last
checkbox (I don't know the exact behaviour (and don't care) but you can
easily do some tests to find out should you wish).
> While it returns from the correct field it is not
> returning the correct record. I read somewhere to
> name checkbox as an array. checkbox[]
> Perhaps this is what I need to do.
Indeed, that is what the manual hints at, and what the articles will tell you
to do.
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
------------------------------------------
/*
Okay ... I'm going home to write the "I HATE RUBIK's CUBE HANDBOOK FOR
DEAD CAT LOVERS" ...
*/
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php