Question

Here is the index.php

 <input type='text' size='90' name='search' onKeyPress='<?php spellcheck($search); ?>'>
 <input type='submit' name='submit' value='Search source code' ></br></br></br>

And here is where checking is suppose to be done.

checker.php

<?php
function spellcheck ( $string ) {
    $words = preg_split('/[\W]+?/',$string);
    $misspelled = $return = array();
    $int = pspell_new('en');
    foreach ($words as $value) {
        if (!pspell_check($int, $value)) {
            $misspelled[] = $value;
        }
    }
    foreach ($misspelled as $value) {
        $return[$value] = pspell_suggest($int, $value);
    }
    return $return;
}
?>

I want to have the same function like in google every time i have my spelling wrong it has underline on it. How can i do that?

Was it helpful?

Solution

This question was already asked and answered once before mate. Take a look and see if their answers are of any use to you.

How to add spelling suggestions to PHP/SQL search script

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top