I want to write a simple search engine that shows the results without reloading the page. I read that it’s possible with the use of hash. I don’t know that much about web programming. Currently with the help of tutorials I managed to write this:
<form action="search.php" method="GET" class="searchform">
<input id='txtInput' class="searchfield" type="text" name="search"/>
<input id='btnSubmit' class="searchbutton" type=submit name="submit" value="Search">
</form>
in the search.php file, I echo out the search results:
for($i=0;$i<$len;$i++)
{
echo "
$titles[$i]<br>
$descs[$i]<br><br><br>";
}
How can I change this to show the search results without reloading the page. (Like google).
What you’re talking about is the use of AJAX (Asynchronous Javascript and XML) which allows for queries to a server without reloading a page. If you are using a framework like JQuery you can use the Ajax function to achieve this. Try reading examples to see how it works.