Forums

This topic is locked

Creating simple sums in dreamweaver pls help?

Posted 12 Apr 2007 17:08:06
1
has voted
12 Apr 2007 17:08:06 John Whiteley posted:
Hey ppl

I am doing an assignment in college and need to create a maths website for children.
Basically I would like to create a set of sums i.e. 7 x 3, 7 x 4
Next to the sum I would like the child to input the answer in a text box.
Then I would like to be able to distinguish whether or not the answer is correct or not.
I know this is a lot but I don’t no were to start, also is this JavaScript orientated?

I really appreciate the help big time!!!
<img src=../images/dmxzone/forum/icon_smile_big.gif border=0 align=middle>

Edited by - Jaw62 on 12 Apr 2007 17:09:25

Replies

Replied 13 Apr 2007 01:58:57
13 Apr 2007 01:58:57 Alan C replied:
Hi

sounds like you are going to need a form for the numbers to go into on the page, then when the submit button is clicked those inputs will go to the server, here you need something that will collect them, do the math and checking then send the feedback as a new page.

The other way to tackle it would be javascript that would look at the values on the page, if you search for javascript input validation you will turn up lots of relevant stuff. My experience of it is limited to checking that textboxes contain something and that email addresses are valid before the form is sent.
Replied 15 Apr 2007 02:51:29
15 Apr 2007 02:51:29 Kenneth Halley replied:
This would be easy with php (server side code) with a form simply submitting to itself ($_SERVER['PHP_SELF']).
The code would then show the right or wrong answers in the browser- however you want to do it.

Obviously you would need to have a server that supports php. You could do it with Javascript too but I reckon it would be a lot harder (thats cos I don't really do much js) Javascript is client side- in the browser.

I would guess by the fact that you are needing to do this on the web, that you ultimately need to be able to send the result somewhere to be processed so ultimately a server side language will be needed- whether it be php, asp or whatever.
There is an example of something very similar in a book I started out with for php by Larry Ullman- PHP and MYSQL for Dynamic websites (Visual Quickpro guide) Think there is an updated version now. But in the early sections it covers submitting a form to itself. If you have DW then the way it builds forms it actually usually does this too- processing the input in the same page before forwarding to a later page.
The code can be hard to read if your not familiar with php, but they include tons of validation and I guess need to fit loads of different purposes.. You also need to decide will you have one sum per page , or all on different pages- if different, then server side is the way to go probably and store the answers in a session (on the server) or cookie on the browser then have something to read it all out at the end.
Finally you will need to decide how much validation to include- none or loads- in case someone enters a blank result or a letter instead of a number etc. DW has built in javascript validation behaviours that would help here.

good luck

-----------------------------------
www.halleynet.co.uk

Reply to this topic