Home arrow PHP arrow Page 4 - Developing a Short and Simple IQ Test Online Using PHP

PHP Script to Process - PHP

If you are a school administrator wanting to have an IQ test online, then this tutorial is for you. It can be used not only in the field of academics, but in the instances where you need to draw user interest to your website. An IQ test is a popular feature to incorporate into your website, and will attract a large amount of web traffic over time.

TABLE OF CONTENTS:
  1. Developing a Short and Simple IQ Test Online Using PHP
  2. Designing an IQ Grading System
  3. The HTML Test Form
  4. PHP Script to Process
By: Codex-M
Rating: starstarstarstarstar / 12
January 14, 2009

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

Below is the source code of IQ.php


<HTML>

<HEAD>

<TITLE>Your IQ Test Result!</TITLE>

</HEAD>

<BODY>

<?php

//Initialize variables

  $T1 = $_POST['T1'];

  $T2 = $_POST['T2'];

  $T3 = $_POST['T3'];

  $T4 = $_POST['T4'];

  $T5 = $_POST['T5'];

  $T6 = $_POST['T6'];

  $T7 = $_POST['T7'];

  $T8 = $_POST['T8'];

  $T9 = $_POST['T9'];

  $T10 = $_POST['T10'];

   $empty=strlen($_POST['age']);

     if ($empty==0)

{

  die('You forgot to enter your age. Press back.Thanks.');

}

  else

{

  $chronologicalage = $_POST['age'];

}


//1

   if($T1 == round)

{

  $TS1 = 3;

}

   else

{

  $TS1 = 0;

}

//2

   if($T2 ==15)

{

  $TS2 = 3;

}

   else

{

  $TS2 = 0;

}

//3

   if($T3 == 15)

{

  $TS3 = 3;

}

   else

{

  $TS3 = 0;

}

//4

   if($T4 == 12)

{

  $TS4 = 3;

}

   else

{

  $TS4 = 0;

}

//5

   if($T5 == 1)

{

  $TS5 = 3;

}

   else

{

  $TS5 = 0;

}

//6

   if($T6 == 13)

{

  $TS6 = 3;

}

   else

{

  $TS6 = 0;

}

//7

   if($T7 =="cnn")

{

  $TS7 = 4;

}

   else

{

  $TS7 = 0;

}

//8

   if($T8 == 1980)

{

  $TS8 = 4;

}

   else

{

  $TS8 = 0;

}

//9

   if($T9 =="vlookup")

{

  $TS9 = 4;

}

   else

{

  $TS9 = 0;

}

//10

   if($T10 == 360000)

{

  $TS10 = 30;

}

   else

{

  $TS10 = 0;

}

//Total mental age scores

$mentalage= $TS1 + $TS2+ $TS3+ $TS4+ $TS5+ $TS6+ $TS7+ $TS8+ $TS9+ $TS10;

  $IQ= ($mentalage/$chronologicalage)*100;

echo "<br />Hi, your IQ is:"." ".round($IQ,0);

echo "<br />";

echo "<br />Thank you for taking this test!<br />"

?>

</BODY>

</HTML>


Basically, you can vary the test questions but never the scoring. You can use this type of test online. Please note that this is not guaranteed to be accurate because it is just a 10 question test.



 
 
>>> More PHP Articles          >>> More By Codex-M
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

PHP ARTICLES

- Hackers Compromise PHP Sites to Launch Attac...
- Red Hat, Zend Form OpenShift PaaS Alliance
- PHP IDE News
- BCD, Zend Extend PHP Partnership
- PHP FAQ Highlight
- PHP Creator Didn't Set Out to Create a Langu...
- PHP Trends Revealed in Zend Study
- PHP: Best Methods for Running Scheduled Jobs
- PHP Array Functions: array_change_key_case
- PHP array_combine Function
- PHP array_chunk Function
- PHP Closures as View Helpers: Lazy-Loading F...
- Using PHP Closures as View Helpers
- PHP File and Operating System Program Execut...
- PHP: Effects of Wrapping Code in Class Const...

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: