a php code

Hongwei Li hongwei at wustl.edu
Mon Jul 26 17:04:50 UTC 2004


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





More information about the fedora-list mailing list