Re: array + checkbox
| From: | Tijmen Hennink | Date: | Mon, 06 Aug 2001 10:24:41 +0000 |
| Subject: | Re: array + checkbox | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-61398@lists.php.net to get a copy of this message | ||
Very weird but it works.
But it doesn't see any changes in the form.
Maybe the PHP is just fine but the HTML contains some shit.
Here is the part that I'm using to generate the form.
if ($aanwezig == "TRUE")
echo(" <TD WIDTH=50 ALIGN=CENTER><INPUT
TYPE=checkbox name=voorraad[] checked></TD>\n");
else
echo(" <TD WIDTH=50 ALIGN=CENTER><INPUT
TYPE=checkbox name=voorraad[] ></TD>\n");
}
It seems that although I can unclick a checkbox it still is selected in the
HTML, strange isn't it?
Well, how do I generate HTML that PHP can use to determine whether a
selectbox is still checked or that is it no longer checked at all.
Tijmen
----- Original Message -----
From: "James Holloway" <james@towntalk.co.uk>
To: <tijmen@mediaconnect.nl>
Sent: Monday, August 06, 2001 12:04 PM
Subject: Re: array + checkbox
> Hi there Tijmen,
>
> Firstly, change the input name from this:
> voorraad
> to this:
> voorraad[]
>
> then do something like:
>
>
> <?
>
> echo "Checked values are as follows:<br><br>";
>
> for ($i = 0; $i < sizeof($voorraad); $i++) {
> if (!empty($voorraad[$i])) {
> echo $voorraad[$i];
> }
> }
>
> ?>
>
> James
>
> "Tijmen Hennink" <tijmen@mediaconnect.nl> wrote in message
> news:001601c11e52$d328e9f0$80c2a8c0@PATRIJS2000...
> Hi All,
>
> I've the following weird problem.
> I have a form which contains an array with values of some checkboxes.
> This is the HTML-part:
> <INPUT TYPE=checkbox name=voorraad checked>
> if checked or
> <INPUT TYPE=checkbox name=voorraad>
>
> Now I want to check which of the checkboxes are really checked.
> So I've got the following PHP code:
> if(count($voorraad[1])>0) {
> echo "VOORRAAD NEE";
> }
> else {
> echo "VOORRAAD JA";
> }
>
> I've tried it with isset($voorraad[1]), count, is_null($voorraad[1]) but
all
> the functions doesn't work.
> Does anyone see what I'm doing wrong??
>
> Met vriendelijke groet/with kind regards,
>
> Tijmen Hennink
> --------------------------------------------------------------------------
--
> tijmen@mediaconnect.nl
> Medi@connect
> --------------------------------------------------------------------------
--
>
> Dit e-mail bericht is uitsluitend bestemd voor de geadresseerde(n).
> Gebruik van deze informatie door andere dan de geadresseerde
> is verboden.
> Het is evenmin toegestaan om deze informatie openbaar te maken,
> te vermenigvuldigen, te verspreiden of te verstrekken aan derden. Aan dit
> bericht kunnen geen rechten worden ontleend.
> Indien u dit mailtje heeft ontvangen terwijl het niet aan u gericht was,
> reply richting mij en verwijder vervolgens de email en uitgeprinte versies
> van dit mailtje.
>
>
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> This e-mail is intended for the use of the addressee(s) only and may
> contain privileged, confidential, or proprietary information that is
exempt
> from disclosure under law. If you have received this message in error,
> please inform me promptly by reply e-mail, then delete the e-mail and
> any printed copy.
>
> Thank you.
>
>
>
>
>
>