I'm writing code to fetch data from the database but it keeps on flagging the error:
Notice: Undefined variable: word in C:\xampp\htdocs\Zubby\admin\updateword.php on line 7
<?php
if(isset($_POST['submit']))
$word = $_POST['word'];
include '../include/config.php' ;
$sql = "SELECT FROM word WHERE word = $word";
$fetch = mysqli_query($connect, $sql);
if ($fetch) {
echo $word;
}else{
echo "No such word exists in the database";
}
?>
<form name="word-Add" method="POST" action="">
<input type="text" name="word" placeholder=" Type the Word "><br><br><br><br>
<input type="submit" name="submit" id="submit" value="Search Word"><br><br><br><br>
</form>