Re: Displaying checkbox values selected
| From: | C Sims | Date: | Fri, 17 May 2002 16:03:59 +0000 |
| Subject: | Re: Displaying checkbox values selected | ||
| References: | 1 2 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-13836@lists.php.net to get a copy of this message | ||
thanks for replies. got it to work. i tried Aziz's solution with $PHP_SELF
but didnt work. this though led me to read about environment variables, and
to cut long story short i changed
register_globals = off to "on" in php.ini file and it worked.
cheers
"Nicole Amashta" <430ntr3k@bellsouth.net> wrote in message
news:3CE5226B.70003@bellsouth.net...
> Since this is dynamically generated, you should be able to determine the
> 'checked' items. If the value is equal to the value of the check box,
> you need to add in 'checked' to the checkbox tab, like so:
>
> <input type="checkbox" name="artist[]" value="Bon Jovi"
> checked>Bon Jovi
>
>
> -nicole
> www.aeontrek.com
>
> C Sims wrote:
> > Hi all,
> > would appreciate any help with this (newbie) question. All im trying to
do
> > is to echo on screen the checkbox values selected by the user. Problem
is
> > when submit is pressed, the selected artists dont appear, it just goes
back
> > to the original screen (with empty checkboxes). Below is the code which
ive
> > copied from another site which supposedly should work. Thanks in advance
for
> > help.
> >
> > in file jukebox.php3
> >
> > <?
> > // check for $submit
> > if (!isset($submit))
> > {
> > // and display form
> > ?>
> >
> > <form action="jukebox.php3" method="post">
> > <input type="checkbox" name="artist[]" value="Bon
> > Jovi">Bon Jovi
> > <input type="checkbox" name="artist[]"
> > value="N'Sync">N'Sync
> > <input type="checkbox" name="artist[]"
> > value="Boyzone">Boyzone
> > <input type="checkbox" name="artist[]" value="Britney
> > Spears">Britney
Spears
> > <br>
> > <input type="submit" name="submit" value="Select">
> > </form>
> >
> > <?
> > }
> > // or display the selected artists
> > else
> > {
> > ?>
> >
> > <b>And here are your selections:</b>
> > <br>
> >
> > <?
> >
> > // use a "for" loop to read and display array elements
> > for($count = 0; $count < sizeof($artist); $count++)
> > {
> > print "<i>$artist[$count]</i><br>";
> > }
> >
> > }
> > ?>
> >
> >
>