I am new to PHP, but 30 years ago I was a Cobol programmer, so I can usually get the concepts then figure out the syntax to use. But this is a concept that is evading me.

I am writing an exercise to help brain injury victims rebuild their ability to concentrate and their memory.

They will be shown X number of images for X number of seconds, then be sent to an answer page to submit their answers on what image was in each position of the exercise.

I am stumped as to how to countdown the seconds available for the test and then automatically send them to the next page.

If someone could give me an idea on what to do, I will figure out how to do it. I would prefer to have to research the syntax simply because I learn better that way instead of someone just telling me exactly what to do.

I appreciate your help on this. I am drawing a complete blank on which way to proceed.

I would suggest using a piece of javascript like the following.

<script>
setTimeout('window.href="http://www.example.com/anotherpage.php";',5000);
</script>

The above redirects the user in 5 seconds and is echo'ed in the <head></head> section as javascript.

if you wish to display a countdown, you will need javascript which will force the redirect for you

I would suggest using a piece of javascript like the following.

<script>
setTimeout('window.href="http://www.example.com/anotherpage.php";',5000);
</script>

The above redirects the user in 5 seconds and is echo'ed in the <head></head> section as javascript.

I know absolutely nothing about javascript, but I can learn if I need to. But will it allow me to send the variables to another PHP program? The answers they have given need to go over to the scoring page/program.

I know absolutely nothing about javascript, but I can learn if I need to. But will it allow me to send the variables to another PHP program? The answers they have given need to go over to the scoring page/program.

Javascript is client side where as PHP is server-side and to pass data between the two there are two methods. On page load PHP can echo data to Javascript but for javascript to send data to PHP a component of Javascript called Ajax is required. Ajax allows communication between the webpage and php at any time even after the page is fully loaded. So I'm sure the answer to that is Yes.

Sounds like I am have to rethink what I am doing here because this is probably a little over my head for now. I want to learn javascript and Ajax but I need to get comfortable with PHP before I start learning them.

I had originally thought of using gif images that blanked out, but that would be very easy for someone to reload the image and cheat, but with what this is for, rarely do people want to cheat, they know cheating is not going to help them.

I appreciate everyones help. I got into this because I am a brain injury survivor and in 3 years I have gone from being unable to remember what 3 cards are, to actually taking online classes to make this new site. The site will be an electronic version of the cards I used to retrain my brain.

In many cases, the human brain can be retrained to learn and think. I figure if I can show others how far I have come it will make them keep pushing to regain some of their own thinking abilities.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.