Hi all,

I am trying to create a website where there are three images on the screen. The user needs to choose one of the images. The image they select needs to be recorded either in a text document or into a mysql database.

For example

Image 1 Image 2 Image 3

User selects image 2

Need to record user x has chosen image 2

Once they have chosen the image. Another 3 images will come up and the user needs to choose again. This also needs to be recorded. This will continue to happen 10 times.

I was thinking about creating a page with 3 images, then another page with 3 images and so on but surely there must be a way in which this could happen on one single page.

I have been researching this for for over two weeks now but am not getting anywhere with this. If there is anybody that can help me it will be greatly appreciated.

Thanks in advance

Recommended Answers

All 5 Replies

Member Avatar for LastMitch

Once they have chosen the image. Another 3 images will come up and the user needs to choose again. This also needs to be recorded. This will continue to happen 10 times.

There's one minor issue you didn't provide any code rgarding whether it's a PHP with JQuery or just JQuery?

What kind of code you done so far? If done something it will be much easier.

Are you familiar with PHP/MYSQL/JQuery?

Questions:

  • Why record the selections - must they be avialable in subsequent sessions and/or to other users?
  • Is there any penalty in including the urls of all 30 images in the downloaded page?

@LastMitch

Its PHP with mySQL as the user can register as well. I am familar with PHP and mySQL but not jQuery.
I will have a login form.

@AirShow - I need to record the selections because at a later stage I need to analyse the results. It is a website survey.

Regarding your second question no there is not a penalty.

Once the user clicks on a image I just need to record user x has chosen image x. Then the next 3 images come up

Member Avatar for LastMitch

Its PHP with mySQL as the user can register as well. I am familar with PHP and mySQL but not jQuery.
I will have a login form.

Login form is not enough. You need a upload form - ajax/php/sql:

http://www.saaraan.com/2012/06/ajax-file-upload-with-php-and-jquery

Image 1 Image 2 Image 3

You need a form and a div container for the 3 images

User selects image 2

Each image is link

Need to record user x has chosen image 2

click on a image 2 and submit form.

Once they have chosen the image.

OK

Another 3 images will come up and the user needs to choose again.

Repeat again.

This also needs to be recorded. This will continue to happen 10 times.

once the form submited it will insert the data into the database.

All you need to do is to select the data.

I was thinking about creating a page with 3 images, then another page with 3 images and so on but surely there must be a way in which this could happen on one single page.

It's a good start.

Personally I would :

  • download the page with all the necessary image urls hard-coded in javascript array(s), or devise a scheme whereby image urls can be determined algorithmically.
  • accumulate all the responses in javascript then make a block-submission of the whole survey in one ajax call at the end. This will avoid the need to handle the asynchronicity associated with a series of ajax calls, one per survey section.

It's difficult to know what else to advise. Writing the code is much easier than explaining how to write it.

I think you should have a go then ask specific questions when you run into trouble.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.