What is wrong with my PHP script?

trina

New member
I've been trying to make this script work but what I do never makes it work. What's wrong with my PHP script?
I'm trying to make a game wherein the player will see scrambled letters of a word and try to make out what the word is by the definition and the synonyms next to it. The player will then type in the word and click the Check It button at the end.
Here is my script (without the separate form script for the player name):
<html>
<head>
<title>
ICT Elective - Final Project - Spell It!
</title>
</head>
<body>
<h2> Spell It! </h2>
<?php
$player = $_POST['user'];
$rw = array("sycophant","parched","exonerate","hackneyed","sciatica","anachronistic","camaraderie","mundane","perfidious","Wary","integrity","novice");
$x = 0;
$ca = 0;
$wa = 0;

echo "<form>";

echo "1. p s n y h c a o t - means to flatter to get an advantage in something <br /> Synonyms: boot-licking, suck up";

echo "<input type=\text\" name=\word1\"/>";

echo "<input type=\"submit\" name=\"submit\" value=\"Check It!\" />";

/* The rest of the words go here

echo "</form>";

$w1 = $_GET['word1'];
if ($w1==$rw[$x])
{
echo "Correct!";
$ca++;
}
else if ($w1=="")
{
echo "";
}
else
{
echo "Sorry, try again!";
$wa++;
}
/* The rest of the if functions go here
echo "No. of <b> Correct Answers </b>" . $ca;
echo "No. of <b> Wrong Answers </b>" . $wa;
if ($ca >= 11)
{
echo "GREAT JOB, " . $player . "!";
}
else if ($ca >= 8)
{
echo "You're pretty good at this!";
}
else if ($ca >= 0)
{
echo "Do better next time, " . $player . "!";
}
?>
</body>
</html>
 
Back
Top