I am trying to create a search bar for website which searches the database but I find that the code it self is displaying inside the search box
<form method="get" action="chalo_search.php">
<input type="search" name="k" size = "20" placeholder="Enter college name" value = "<?php echo $_GET['k'];?>" autofocus/>
<input type= "submit" value="Search"/>
</form>
is there any error in this
You’re echoing $_GET[‘k’] into the input box. If $_GET[‘k’] isn’t defined, you will get this error:
(That’s what’s appearing in your search box)
Check that $_GET[‘k’] is defined first: