Link to home
Start Free TrialLog in
Avatar of CodilX
CodilX

asked on

AJAX quiz/list editor

Hi there,

Can someone help me out with a quiz creator script?

The idea is, that i have 62 images 01.jpg, 02.jpg, 03.jpg .... 60.jpg, 61.jpg, 62.jpg. and I want to create 3 questions for each of them. (like, what animal is this? dog, cat, bird)

What I want is that they would be in a list, like so:

  for ($i=1; $i <= 62; $x="", $i++) {
 
    if (strlen($i) == 1) {
      $x="0";
    }
   
    echo "
    <li>
      <a href=\"#\"><img src=\"/thumbs/gallery/$x$i.jpg\" /></a>
    </li>
    ";
 
  }

and once I click on an image, i would get a ajax form popup or slide down or whatever, and I would be able to enter question1, question2, question3 and save it to mysql using this query:  

$do = mysql_query('INSERT INTO quiz (id,image,question1,question2,question3) VALUES (NULL,"' . $_POST['image'] . '","' . $_POST['question1'] . '","' . $_POST['question2'] . '","' . $_POST['question3'] . '")');

I tried doing this and it's fine if there is only 1 image, but I just can't get ajax to do this dynamically with all  of them
ASKER CERTIFIED SOLUTION
Avatar of CodilX
CodilX

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial