46 users online (1 members and 45 guests)  

Thread: online tests


Page 1 of 2 1 2 Last
  Results 1 to 15 of 22

Related

  1. Turnkey Online Businesses is the Best way to Earn Money Online in 2014    Forum: Affiliate Marketing and Reseller Programs
    Replies: 0
  2. Online TV    Forum: General Discussion
    Replies: 0
  1. #1
    pegboy's Avatar
    Senior Member

    Status
    Offline
    Join Date
    Aug 2001
    Location
    Knoxville, TN
    Posts
    76

    Post online tests.....

    I'm working on an online course for the University on Tennessee. there are two parts to the lessons: 1) the text material 2) the worksheet. On the worksheet they want it set up so the person has a place to write in their answer, then click an input button to get the answer on the same page. I've seen something like this before, but have no idea how to code it.

    Anyone worked with this sort of thing before? Any help would be greatly appreciated. Thanks.
    robert koons

  2. #2
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662

    Hmm

    I can think of a few different ways to do this.

    The one would use would be php, with a mySQL database in the background.

    By the sound of it, though, I'm guessing you haven't done a lot of database stuff?

    You could code it with JavaScript, but it would be ugly and clunky.

    Okay, a few questions -

    Will the questions need to change constantly?
    Will the questions be Multiple Choice, or will they be text input?

    If the questions stay stable, and are multiple choice, I could probably come up with a PHP script that will do the job. No Database, just textfiles.
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  3. #3
    pegboy's Avatar
    Senior Member

    Status
    Offline
    Join Date
    Aug 2001
    Location
    Knoxville, TN
    Posts
    76
    the questions won't change, but there will be several on each page. the answers will be text. I was thinking about having the student answer all the questions on the page, then click the input button on the bottom of the page that will refresh the page to show the answers. that's just how i had it in mind, is that possible?
    thanks
    robert koons

  4. #4
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662

    Very possible!

    Thats a much easier way to do it.

    JavaScript still won't cut the mustard, though. You will need some kind of server-side CGI process.

    rather than hunting through millions of perl scripts to find what you need, php can do the job no problem.

    Do you have a knowledge of PHP? If so, I'll post a quick run-down of the script process you will need.

    If not, I can post a sample script that you can expand and adapt to suit your needs.

    Probably, someone could write you a perl script, but my knowledge of perl is quite small (can spell it, not much more).

    Fancy trying it in PHP? (does your server run PHP?)
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  5. #5
    pegboy's Avatar
    Senior Member

    Status
    Offline
    Join Date
    Aug 2001
    Location
    Knoxville, TN
    Posts
    76
    I have never worked with PHP, and the few times i've tried to get a PERL CGI script to work i felt like pullijng my hair out. I'm all about trying PHP if you would like to help. Thanks again.
    robert koons

  6. #6
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662

    Here we go..

    Okay, I'm going to make a one-question example (I'm lazy! I have just got up!)

    First page is our form - (I'm skipping all the < HTML> etc)

    < form method="post" action="answers.php">
    < input type="hidden" name="submitted" value="true">

    So, whats your favourite ice-cream?<br>
    < input type="text" size="15" name="icecream"><br>
    < input type="submit">

    I know you know how to make a form I just want to make sure you see how php takes the input names in the script.


    Right, now heres answer.php -

    PHP Code:
    <?
    if ($submitted) {

         echo 
    "Your answer was $icecream, <br><br>
    the actual answer is Mint choc chip."
    ;
    }
    ?>
    Thats it! It's clunky and simple, but if you have never used php before it may be enough to get you into it.

    Points for php - every processing line has to end in a ; (unlike JavaScript where you can be lazy)

    If you need a " character in an echo, then you need to escape it like this \" .

    you can put perfectly normal HTML outside the <??> tags. Where you put the script just defines where the echo will happen.

    Have fun! Any questions, you know where I am





    ________________________
    apologies for the edit, none of the post changed.
    D
    Last edited by HTML; 08-16-2001 at 04:59 PM.
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  7. #7
    pegboy's Avatar
    Senior Member

    Status
    Offline
    Join Date
    Aug 2001
    Location
    Knoxville, TN
    Posts
    76
    this may be a stupid question, but is the PHP code on a seperate HTML page? I posted what i thought would work here: www.tminusfive.com/test
    i put the PHP in an HTML page with the suffix being *.PHP, but it wouldn't work. what am i doing wrong?
    robert koons

  8. #8
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662

    I can view the source..

    This basically means that your server has not parsed the code as PHP. Your server has not got PHP installed.

    it could be that it insists on php3. Try renaming the first tag to

    <?php3

    and if that doesnt work then try renaming the file (and destination in the form) to *.php3

    Hope that works! Check with your host to see if they run php. It's incredibly popular (even free hosts run it!) but not everyone uses it, especially NT servers (haack ptui)
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  9. #9
    HTML's Avatar
    Administrator

    Status
    Offline
    Join Date
    Aug 2000
    Posts
    3,445

    Follow HTML On Twitter Add HTML on Facebook Add HTML on Google+ Add HTML on Linkedin Visit HTML's Youtube Channel

    Re: I can view the source..

    Originally posted by QuietDean
    (haack ptui)
    38 years and I have never seen it spelled before lol
    AHFBWEB Less customers per server, more power for you!

    Business Class Shared Hosting

  10. #10
    pegboy's Avatar
    Senior Member

    Status
    Offline
    Join Date
    Aug 2001
    Location
    Knoxville, TN
    Posts
    76
    I believe you're right about my server not running PHP. I moved the test to another server i use. i tried making the changes you suggested, but now i get an error. if you still feel like fooling with this i have it posted here:
    www.pastmistakes.com/test
    thanks again.
    robert koons

  11. #11
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662

    Good news!

    At least its parsing it now! Unfortunately, this means that the code no longer gets transmitted to the browser....so I cannot see !

    Could you post answers.php so's I can 'ave a look?
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  12. #12
    pegboy's Avatar
    Senior Member

    Status
    Offline
    Join Date
    Aug 2001
    Location
    Knoxville, TN
    Posts
    76
    here's what's on the answers.php page.

    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>

    <body bgcolor="#FFFFFF">

    <?php3
    if ($submitted) {

    echo "Your answer was: $, <br><br>
    The actual answer is Mint choc chip.";
    }
    ?>

    </body>
    </html>
    robert koons

  13. #13
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662

    AH HAH!

    The problem is the variable name, $ .

    It needs to be $icecream .

    When the form is submitted, then the text input named icecream automagically converts into a variable called $ icecream.

    So when you make this a proper test, you will need to name each form field, and then a variable+answer for each one.

    This should work now, let us know either way!

    PS - If you get into PHP a bit more, then you can download the php manual at http://www.zend.com

    Also, they have lots of example scripts there.
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  14. #14
    pegboy's Avatar
    Senior Member

    Status
    Offline
    Join Date
    Aug 2001
    Location
    Knoxville, TN
    Posts
    76
    It Works!!!

    After adding the input variable, I also had to take off the "3" on the suffix.

    Thanks so much for your help!
    robert koons

  15. #15
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662

    ahhh

    another php user initiated into the ranks...today this forum...tommorow the world...

    Glad to help.
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?



Page 1 of 2 1 2 Last

Tags for this Thread