Jump to content

Help with a script


dtommy79

Recommended Posts

Hi,

 

I'd like to create a simple script that would do the following:

 

It would be a word learning script (to learn new vocabulary in a foreign language).

This is how it should work: let's say 10 words (in my language) are displayed randomly and I have to write the meaning of those words in English next to it. For example, in my language 'apple' means 'alma'
The script would display:
alma => ___________

I'd have to write apple on the empty line or text field. If it's correct a green checkmark would appear next to it, if not a red cross.

I should be able to add the correct word pairs into the script, and it would display 10 word pairs randomly when I refresh the file in the browser.

 

I'd appreciate if someone could point me into the right direction.

 

Thanks

Link to comment
Share on other sites

Well this could be fairly easy or complicated depending on how many different words you're talking about and whether you have a direct word-to-word correlation between the 2 languages.  There may be some language api out there that has the word pairs already, otherwise you're kind of left to the making it yourself word for word, which would be extremely time consuming depending again on how large a vocabulary you want.

 

Beyond that it becomes easy to actually handle the checking and refreshing a word list. 

1. Create an array or words to display and store those in a session var.

2. Output the session array with text boxes for the user to type in the answer.

3. Submit the form and check that the answers match the session array.

4. If the answers match, create a new session array of words and re-output those to the user, and so on.

 

If you are wanting this to happen without refreshing the page, so the answer is validated as the user moves to the next word, you'll need to use javascript and ajax to do the checking live as they type.  All of this is really pretty easy stuff and there are tons of tutorials about the similar concepts used to do this, just need to google it or my favorite is to check out phpacademy on youtube.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.