Hi all, Here's a snippet of a code for a spell checker that I am working on. I've done all the checking correctly, except that after checking and correcting, I have absolutely no idea how to return the modified message back to the previous form. Can anyone please help? Thanks in advance, --mel --code-- function spellcheck($word) { if ($word == "") { return false; } $pl = aspell_new("english"); if (aspell_check($pl, $word)) { return true; } else { return false; } } function suggest($word) { $pl = aspell_new("english"); $suggestions = aspell_suggest($pl, $word); if (count($suggestions) == 0) { $suggest = "Sorry, no suggestions available"; } else { /* temp solution for IE */ $suggest = "<option selected>$suggestions[0]</option>"; for ($i = 1; $i < count($suggestions); $i++) { /* javascript does not like quotes... */ if (!preg_match("/[a-zA-Z]'[a-zA-Z]/", $suggestions[$i], $parts)) { $suggest .= "<option>".$suggestions[$i]."</option>"; } } } return $suggest; } $org_message = $message; /* message is from previous form, in a textarea */ $message = stripslashes($message); $message = preg_split("/\s+/", $message); function spellwin($word, $suggestion, $count) { $mistake = "foo".$count; $len = strlen($word); $tmp = "$suggestion"; $ret = "<input type=\"text\" name=\"$mistake\" value=\"$word\" size=$len>"; $next = "<input type=\"button\" value=\"C\" onClick=\"javascript:suggest('$word', document.speller.$mistake.value, '$tmp', $len, $count)\">"; //document.speller.$suggestion.options[document.speller.$suggestion.selected Index].value)\">"; //$next = "<input type=\"button\" value=\"C\" onClick=\"javascript:suggest(document.speller.$mistake.value)\">"; $ret .= $next; return $ret; } echo "<html>"; ?> <script language="JavaScript"> function suggest(word, mistake, suggestion, len, num) { var kiosk; kiosk = window.open("", "speller", 'resizable=yes,scrollbars=yes,status=0,width=300,height=160'); kiosk.document.writeln('<head><title>Spell Check</title></head>'); kiosk.document.writeln('<body bgcolor="#ffffff">'); kiosk.document.writeln("Misspelt word:"); kiosk.document.writeln("<form name='f0'>"); kiosk.document.writeln("<font size=-1> Replace with: </font><input type=text value='"+word+"' name='manual' size='"+len+"'>"); kiosk.document.writeln('<input type=button value="change" onclick=\'window.opener.document.speller.elements["foo'+num.toString()+'"].val ue=document.f0.elements["manual"].value;window.close();\'><br>'); kiosk.document.writeln("<font size=-1> Suggestions: </font><select name='s0'>" + suggestion); kiosk.document.writeln("</select>"); kiosk.document.writeln('<input type=button value="change" onclick=\'window.opener.document.speller.elements["foo'+num.toString()+'"].val ue=document.f0.s0.options[document.f0.s0.selectedIndex].text;window.close();\' ><br>'); kiosk.document.writeln('<br><a href="javascript:window.close()">Skip Changes</a>'); kiosk.document.writeln("</form>"); kiosk.document.writeln('</body>'); kiosk.document.close(); return true; } </script> <? echo "<form name=\"speller\" action=\"spcheck.php\" method=\"post\">"; for ($i = 0; $i < count($message); $i++) { if (!is_url($message[$i]) && !is_email($message[$i]) && !is_apros($message[$i]) && !is_num($message[$i]) && !is_sign($message[$i]) ) { $w = has_sign($message[$i]); $res = spellcheck($w); if ($res == false) { $suggest = suggest($w); $message[$i] = spellwin($w, $suggest, $i); } } echo "$message[$i] "; //echo "No spelling error found"; } /* !! now what do I put here? */ echo "<input type=\"hidden\" name=\"corrected\" value=\"WHAT_DO_I_PUT_HERE?\">"; echo "<input type=\"submit\" name=\"submit\" value=\"Done\">"; echo "</form>"; ?> ------------------------------------------- The Fastest Browser on Earth now for FREE!! Download Opera 5 for Windows now! Get it at http://www.opera.com/download/ ------------------------------------------- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]