[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 353
  • Last Modified:

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
0
CodilX
Asked:
CodilX
1 Solution
 
CodilXAuthor Commented:
found the solution on another site :)
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now