MBod,
not entirely sure what your on about here, you'll have to explain a little better.
If all your trying to do is generate a print out of math problems, then you need to do somthing like this:
<?php
$maxindex = 3; // Max index you have, in this case a quarter
$penny = 0; // Array index for penny
$nickel = 1; // "" Nickel
$dime = 2; // and so
$quarter = 3; // on.
$value[$penny] = .01;
$value[$nickel] = .05;
$value[$dime] = .10;
$value[$quarter] = .25;
$coin[$penny] = "<img src = \"/coinfolder/pennyhead.jpg\">";
$coin[$nickel] = "<img src = \"/coinfolder/nicklehead.jpg\">";
$coin[$dime] = "<img src =\"/coinfolder/dimehead.jpg\">";
$coin[$quarter] ="<img src =\"/coinfolder/quarterhead.jpg\">";
$suma = array();
$sumb = array();
$answers = array();
$questioncount = 10;
// Make some random questions.
for($count=0;$count<$questioncount;$count++)
{
// Pick two random coin indexes.
$coina = rand(0,$maxindex);
$coinb = rand(0,$maxindex);
// Store the indexes.
$suma[$count] = $coina
$sumb[$count] = $coinb;
// Compute the actual answer and store.
$answers[$count] = $value[$coina] + $value[$coinb];
print "<h3>Question ".($count + 1)."</h3>";
print "<img src='".$coin[$coina]."'/>";
print " + ";
print "<img src='".$coin[$coinb]."'/>";
print " = ";
print "<input type='text' name='answer_".$count."'/>";
}
?>
This will generate 10 math problems, then print the appropriate coins on the screen with the +'s & ='s and a text box for the
answer to be typed in. I'll leave it to you to wrap it in a form or ajax call, but essentially "$value[$suma[$index]]" will
give you the first value at index $index, and "$value[$sumb[$index]]" will give you the second.
$coin[$suma[$index]] will give you the image, likewise using $sumb will give you the second.
$answers[$index] will give you the answer to the 2 values.
The name for the text box is set to "answer_X" where X is the index of the question at that position, so in your post handler
you can find the array index by searching the name string for a _ then taking everything after it using substr and using it
as an integer index.
Hope it's of some use.
If you want to explain in more detail what your trying to do i'll be able to give you a better answer.
Cheers
Shawty