Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-18-2012, 07:32 AM   PM User | #1
tpeck
Regular Coder

 
tpeck's Avatar
 
Join Date: Oct 2002
Location: Sydney, Australia
Posts: 771
Thanks: 40
Thanked 5 Times in 4 Posts
tpeck is on a distinguished road
javascript database

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?
__________________
The difference between genius and stupidity is that genius has its limits. (Albert Einstein)
tpeck is offline   Reply With Quote
Old 11-18-2012, 08:21 AM   PM User | #2
minder
Banned

 
Join Date: Oct 2012
Posts: 81
Thanks: 0
Thanked 4 Times in 4 Posts
minder can only hope to improve
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.

Last edited by minder; 11-18-2012 at 08:24 AM..
minder is offline   Reply With Quote
Old 11-18-2012, 09:19 AM   PM User | #3
Philip M
Supreme Master coder!

 
Philip M's Avatar
 
Join Date: Jun 2002
Location: London, England
Posts: 17,033
Thanks: 197
Thanked 2,410 Times in 2,388 Posts
Philip M has a spectacular aura aboutPhilip M has a spectacular aura aboutPhilip M has a spectacular aura about
Quote:
Originally Posted by tpeck View Post
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

.
__________________

All the code given in this post has been tested and is intended to address the question asked.
Unless stated otherwise it is not just a demonstration.
Philip M is offline   Reply With Quote
Old 11-18-2012, 10:58 AM   PM User | #4
tpeck
Regular Coder

 
tpeck's Avatar
 
Join Date: Oct 2002
Location: Sydney, Australia
Posts: 771
Thanks: 40
Thanked 5 Times in 4 Posts
tpeck is on a distinguished road
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!
__________________
The difference between genius and stupidity is that genius has its limits. (Albert Einstein)
tpeck is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:00 PM.


Advertisement
Log in to turn off these ads.