RE: [PHP-WIN] Displaying checkbox values selected

From: Date: Fri, 17 May 2002 15:13:40 +0000
Subject: RE: [PHP-WIN] Displaying checkbox values selected
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-13833@lists.php.net to get a copy of this message
<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:calebsim@optushome.com.au] Sent: Friday, May 17, 2002 6:01 PM To: php-windows@lists.php.net 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

« previous php.windows (#13833) next »