I am trying to make a hanging man game.
I have ten words with 5 letters each.
the program is supposed to choose one word out of the ten randomly and the user has to guess the letters and replace the underlines that appear on screen. the correct letters stay on screen. there is also a picture of the hanging man and with each mistake a body part appears- they get 6 tries or they fail.
This is my code so far, it's a mess because I don't really know what i'm doing... (my ten words are in hebrew at the top)
I'll really appreciate some help
<?php
session_start();
if ( !isset($_SESSION['word']) )
{
$wordList="שולחן
וילון
מדפסת
גיטרה
פסנתר
דרקון
תרמיל
בקבוק
חולצה
תמונה";
}
?>
<html dir="rtl">
<body>
<?php
if(isset($_POST["exit"]))
{
?>
תודה ולהתראות!
<br>
<form action="game.php" method="post"><br><br>
<input type="submit" value="חזור למשחק" />
</form>
<?php
}
elseif(isset($_POST["guessletter"]))
{
if(!isset($_SESSION["totalGuess"]))
{
$_SESSION["totalGuess"] = 0;
}
$totalGuess= 0;
}
$maxError=6;
$wordList= rand(1,10);
$pickedWord= $wordList
if (!isset($_SESSION["word"]))
?>
איש תלוי
<br><br>
<img src="0.jpg"/>
<form action="game.php" method="post" >
<font size="+6"><?php echo "_ _ _ _ _"; ?></font><br><br>
<input type="text" name="guessletter" />
<input type="submit" name="guess" value= "נחש"/>
<br><br>
<input type="submit" name="exit" value= "יציאה"/>
</form>
</body>
</html>
mod edit: meaningful title and put ending php code tag after the end of the code (edit2: unfortunately, the php code tag processing displays the foreign language characters as entities.)