html - Spelling Check in PHP -


this question has answer here:

<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

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -