...

View Full Version : javascript database



tpeck
11-18-2012, 07:32 AM
I realise this is out on the edge, but does anyone know of a method to store the answers to, say, a multiple choice quiz in a database?

If a user logs in to a site - username and PW - could that login be used to save his/her answers discreetly to the database?

minder
11-18-2012, 08:21 AM
Not sure what you mean by "out on the edge" but storing data (quiz answers etc etc etc) is a very common task and is the general concept behind all database (dynamic) driven websites.

Storing/retrieving data in a database is done server side and so you'll need a server side language like PHP, ASP, Java and not javascript which is a client side language.

Basically, when a user logs in you store their userID in a session variable. You then givem them a html form with the quiz qustions. When they click the form's submit button, their answers are sent to a server side script which first validates and santises the form data before using sql commands via the server side language to store the sent form data in a database table(s) and link it to the userID.

Philip M
11-18-2012, 09:19 AM
If a user logs in to a site - username and PW - could that login be used to save his/her answers discreetly to the database?

If "discreetly" means covertly or clandestinely or surreptitiously then I think there is a moral issue to consider.

It is your responsibility to die() if necessary….. - PHP Manual

.

tpeck
11-18-2012, 10:58 AM
By 'out on the edge' I meant very difficult to achieve, not wrong!

And by 'discreet' I meant saved such that one's answers were not made available to others.

I will check out the non-javascript options.

Thanks!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum