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>"; > } > > } > ?> > > -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php