all i can do with this code is output it in a different page and change the color of the mispelled word. What i want is to underline or change the color of the mispelled word in the same page and same textbox.
here is my code. please. need help.
Code: Select all
<?php
include("ecsel_connectdb.php");
$var=$_POST['textarea'];
$var= trim($var,"\t\r\n");
$mypar=explode('.',$var);
//sentence
foreach($mypar as $b)
{
$b=trim($b, "\t\r\n ");
echo "$b - This is a sentence";
echo "<br/>";
echo "<br/>";
}//end first for
$var=trim(str_replace('.','',$var));
$myarray=explode(' ',$var);
$pspell_link = pspell_new("en");
foreach($myarray as $a)
{
$var=trim(str_replace('.','',$var));
$a=trim($a, "\t\r\n ");
$pspell_link = pspell_new("en");
if (pspell_check($pspell_link, $a))
{
echo "$a - This is a valid spelling";
echo "<br/>";
echo "<br/>";
} //end if
else
{
/*echo "$a - Sorry, wrong spelling";
echo "<br/>";
echo "<br/>";
*/
/* echo $var;
echo "<br/>"; */
echo "<font size=\"3\" face=\"Segoe UI\" color=\"red\"> $a <b><br /><br /><br><br> </font>";
$wrong=$wrong +1;
if (!pspell_check($pspell_link, $a))
{
$suggestions = pspell_suggest($pspell_link,$a);
foreach ($suggestions as $suggestion)
{
echo "Possible spelling: $suggestion<br />";
//echo "<br/>";
}//end inner for
}//end inner if
}//end elsehind
}//end for
?>