Re: Simple newbie problem, please help!

From: Date: Fri, 17 Nov 2000 17:12:31 +0000
Subject: Re: Simple newbie problem, please help!
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-25922@lists.php.net to get a copy of this message
Thanks to both replies, much appreciated! Omar Robert Collins wrote: > > Somthing like this may be what you are looking for > <? > $questions = array("question 0", "question 1", "question 2", > "question 3", > "question 4", "question 5", "question 6", "question 7", > "question 8", > "question 9",); > > for ($i=1; $i<=count($questions); $i++) { > echo "$questions[$i]<BR>"; > } > ?> > > -----Original Message----- > From: Static [mailto:me@143.com] > Sent: Friday, November 17, 2000 9:07 AM > To: php-general@lists.php.net > Subject: [PHP] Simple newbie problem, please help! > > Hi everyone, I have a simple loop problem. > > Let's say I have 10 quiz questions, and for each one I have a > variable, > i.e. q1answer, q2answer, etc... and in a for loop, I want to print them > out in a table. So I do something like this: > > for ($i = 1; $i <= 10; $i++) { > echo "<td width=\"25%\" bgcolor=\"#66CCFF\">"; > echo "<p align=\"center\"><font face=\"Arial\" > size=\"2\">VARIABLE > HERE</font></td>"; > > My problem is I don't know how to construct the VARIABLE HERE part. I > tried doing some kind of concatentation like q.$i.ans but that is > obviously wrong. Can someone please steer me in the right direction... > if an array is necessary, what needs to be done to get the 10 vars into > the array? > > Thanks so much in advance, > Omar > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#25922) next »