<form action="<? echo $PHP_SELF; ?>" 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>

try this.....
-----Original Message-----
From: C Sims [mailto:[EMAIL PROTECTED]]
Sent: Friday, May 17, 2002 6:01 PM
To: [EMAIL PROTECTED]
Subject: [PHP-WIN] Displaying checkbox values selected


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>";
 }

}
?>



--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to