for loop and array

From: Date: Wed, 25 Sep 2002 06:16:14 +0000
Subject: for loop and array
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-117523@lists.php.net to get a copy of this message
Good Morning all I need some help as to how to print this array, its input name is labtype and they all have differnet values. Amylase<input name='labtype' type='checkbox' value='Amylase'> <td align=right>Cholesterol<input name='labtype' type='checkbox' value='Cholesterol'></td></tr> <tr><td align=right>CMV Ab IgM/G<input name='labtype' type='checkbox' value='CMV'></td> <td align=right>GLUCOSE - Fasting<input name='labtype' type='checkbox' value='GLU_Fast'></td></tr> <tr><td align=right>GLUCOSE - Random<input name='labtype' type='checkbox' value='GLU_Rand'></td> <td align=right>Hepatitus B S Ag<input name='labtype' type='checkbox' value='Hepb_ag'></td></tr> On the page I created if the person selects any of these then it should submit it as name=labtype and value="whatever is selected" this works. Now upon getting this info onto my php script how would I say something like for each item in the array labtype, print its value? Any help would be really appreciated, I have had a look at a for loop trying to use the following for ($a=1; $a<50; $a++) { echo "<br>$labtype[$a]"; } but this is not working for me. Can anyone direct me in the right way ???

« previous php.general (#117523) next »