My array is as follows:
Array ( [questions] => q1 [qnum] => 1 [qtext] => I love crisps [page] => 1 )
Array ( [questions] => q2 [qnum] => 2 [qtext] => I love chocolate [page] => 1 )
All I would like to do is print the contents of the array in a loop, so it looks something like:
q1 1 I love crisps
q2 2 I love chocolate
If anyone could supply the PHP and HTML code, that would be great, thanks.
This is a multi-dimensional array – I should have stated that. In addition, I want to be able to access each element of the array row, for example. I also want to just access the [qtext] element on its own.
Is this possible?
Homer.
You can use the
foreachconstruct here.If you wanted to print out the keys too you could use:
And if you just want to print out for debugging there’s always