html - Spelling Check in PHP -
this question has answer here:
- reference - error mean in php? 29 answers
<table align = "left">   <?php  if ($_post["word"] == "ship" ) { echo "your answer correct."; } else { echo "sorry, typed wrong answer. try again!"; }   ?>  <tr> <td> <span id="dummy" onclick="playsound(this,'vowels/ship.mp3');"> <img src="pics/i.jpg" onmouseover="this.src='pics/vowel/ship.jpg';this.width=200;this.height=250" onmouseout="this.src='pics/i.jpg';this.width=100;this.height=150"/> 
 <form action="act_vowel.php" method="post">  <h2> <font color = "black">  type word: <input type="text" name="word"> </h2> </font>   <input type="submit" name="check" value="answer">   </form> when run code. error says this:
  (notice: undefined index: word in c:\xampp\htdocs\dyslexia\sample.php on line 15   sorry, typed wrong answer. )  and how can design result user type answer? want more lively. thanks!
you need check if post value defined:
if (isset($_post["word"])) {     if ($_post["word"] == "ship" )     {         echo "your answer correct.";     }     else     {         echo "sorry, typed wrong answer. try again!";     } } 
Comments
Post a Comment