-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
46 lines (39 loc) · 1.04 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
include_once("autocorrect.php");
$corrected_word = "";
$word = "";
$sentence = "";
if(isset($_GET["doautocorrect"])){
$word = $_GET["word"];
$autocorrect = new AutoCorrect();
$corrected_word = $autocorrect->correct($_GET["word"]);
if ($corrected_word === $word) {
$sentence = " - $word is spelled correctly.";
} else {
$sentence = " - $word should be spelled as $corrected_word .";
}
/*else if (typeof correction === "undefined") {
return " - " + word + " didn't get any output from the spellchecker.";
}*/
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Auto Correct</title>
</head>
<body>
<form action="#" method="get">
Type in Word and click submit<br><br>
Word:<br>
<input type="text" name="word" value="<?php echo $word;?>"><br>
Corrected Word:<br>
<input type="text" name="corrected_word" value="<?php echo $corrected_word;?>" disabled>
<input type="hidden" name="doautocorrect" value="Mouse">
<br>
<br><?php echo $sentence;?>
<br>
<input type="submit" value="Submit">
</form>
</body>
</html>