Hi i want to create a form which can generate md5 hash from the word submitted from the text field, and want it to be saved in mysql database.
I also want to be able to save each and every query if possible. it should be able to check it that value already exists.
later i want to create a search engine to search the word from the md5 hash
your last statement says that you want to search for words from their MD5 hashes and want to design a search engine for that. The thing is, that Message Digest [or MD5] is a many-to-one function i.e. there are many words which will have the same MD5 output. Hence, MD5 is not an encryption algorithm, it's a hashing algorithm. Small words, upto let's say 12-15 characters MAY have unique keys for unique inputs, but for anything greater it cannot be guaranteed. Even if it is so, MD5 is not a reversible or invertible function. You cannot just run an inverse on MD5 and get the word you originally hashed. To do this, you need to use Brute-force, but using it in the form of a search engine would be very very expensive [computationally expensive i.e.].
The best thing you can do is just store the words [keywords or tags] as it is and search for it. As to how to store and retrieve stuff from an SQL database, i'd suggest you refer some material at w3schools.com.
I'm pretty sure the guy just want's a reverse md5 lookup script of his own.