a php code

Jake McHenry linux at nittanytravel.com
Tue Jul 27 04:27:06 UTC 2004


----- Original Message ----- 
From: "Hongwei Li" <hongwei at wustl.edu>
To: <fedora-list at redhat.com>
Sent: Monday, July 26, 2004 1:04 PM
Subject: a php code


> Hi,
>
> We have fc1 with php 4.3.6-1.3 and apache 2.  I have a problem with php
> codes and ask for help.
>
> My question might be off topic of this list.  But, since I don't know a
> good mailing list of php groups, so I post it here.  If somebody can help
> me, or tell me a good place to ask, I'd greatly appreciate.
>
> Here is my test code, called fm.php:
>
> <?php
> if (!isset($pick)) {
>  echo "Select color(s) and submit the form below."; }
> else {
>  $j = count($pick);
>  for($i=0; $i<$j; $i++) {
>   echo "Pick <b>$pick[$i]</b> is Checked<br />"; }
>  }
> ?>
>
> <form action="<?php echo $_SERVER['PHP_SELF']; ?>">
> <ol>
> <li>Red<input name="pick[]" type=checkbox value="Red" /></li>
> <li>Blue<input name="pick[]" type=checkbox value="Blue" /></li>
> <li>Yellow<input name="pick[]" type=checkbox value="Yellow" /></li>
> </ol>
>
> <input type="submit" value="Submit!" />
> <input type="reset" value="Reset" />
> </form>
>
> When I test it, the browser displays the form with "Select color(s) and
> submit the form below.", and the browser address box shows
> http://.../fm.php
>
> If I select any boxes (e.g. Red and Blue) in the form and click "Submit",
> it does not show anything like "Pick... selected", but still "Select
> color(s) and submit the form below.", only the browser address box changed
> to
>
> http://.../fm.php?pick%5B%5D=Red&pick%5B%5D=Blue
>
> Is there anything wrong? in the code or in the php setting?
>
> I appreciate all help!
>
> Hongwei
>
>
> -- 
> fedora-list mailing list
> fedora-list at redhat.com
> To unsubscribe: http://www.redhat.com/mailman/listinfo/fedora-list
>

The php mailing list is at lists.php.net. Here is the general list:
http://lists.php.net/php.general . You can subscribe to it by sending an
email to php-general at lists.php.net with subscribe as subject. As for your
problem, try $_GET['$pick'] instead of just pick in your !isset($pick) line.

Jake






More information about the fedora-list mailing list