Jump to content

Time question


AV1611

Recommended Posts

I have a script that is a math speed drill for my kids (see it in action at http://blmservices.com/~osprey/school/mathdrill.php)

 

It simply gives them 50 match problems, and when they finish it gives them a score.

 

I now need to get the script to tell them how long they took.

 

Basically, I need to capture the time of the first time the script loads, then mark the time when the last time the script runs, and display how long it took....

 

I'm lousy with doing math on time...

 

Can someone suggest to me what time function to use?  I need only to know how many minutes and seconds they took.

 

here is the entire script if someone wants it for they're kids:

 

<STYLE TYPE="text/css">
<!--
TD{font-family: Verdana; font-size: 20pt;}
div{font-family: Verdana; font-size: 20pt;}
--->
</STYLE>
<div>
<center>
<?php
if(!isset($_GET['problem'])){
$problem=1;}
else
{$problem=$_GET['problem'];}

if($problem==51){
$correct=$_GET['correct'];
if(isset($_POST['answer']) && $_POST['answer']==$_GET['answer']){
	$correct=$correct+1;}
$grade=($correct/50)*100;
echo "<h2>Total Correct: ".$correct." Grade: ".$grade."%</h2>";
}
else
{

if(!isset($_GET['correct'])){
$correct=0;}
else
{$correct=$_GET['correct'];}


if(isset($_POST['answer']) && $_POST['answer']==$_GET['answer']){
$correct=$correct+1;}

echo "Problem: ";
echo $problem;
echo " Correct: ";
echo $correct;
echo "<br/><br/>";



$problem=$problem+1;
$top=rand(1, 99);
$bottom=rand(1, 99);
$answer=$top+$bottom;
echo "<table>";
echo "<tr><td align='right'>";
echo $top;
echo "</td></tr>";
echo "<tr><td align='right'>";
echo "+".$bottom;
echo "</td></tr>";
echo "<tr><td align='right'>";
echo "<form name='sform' METHOD='POST' action='http://blmservices.com/~osprey/school/mathdrill.php?problem=$problem&correct=$correct&answer=$answer'>";
echo '<input type="text" SIZE="10" name="answer">';
echo "</td></tr>";
echo "<tr><td align='right'>";
echo "<input type='submit' name='Submit' value='Answer'>";
echo "</td></tr>";
echo "</table>";
}
echo "<h2><a href=./mathdrill.php?problem=1>Start Again</a></h2>";
?>
</center></div>



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.