i mean suppose i want a user to enter a random String that i will generate through code and if the user is not able to fill the in 5 min then the again a different key will bw given to him through code
I am assuming you are requiring a captcha of some sort.
As pritaeas stated, look into AJAX.
You can refresh a css DIV using AJAX without refreshing the entire page.
Generate the string with PHP and embed the string/function into the css DIV.
Make an AJAX call whenever you want it to refresh, by doing this you should generate a function call to your PHP.
Update your database and/or sessions to the newly generated string to allow comparison.
Doesn't really sound like a very secure captcha check though. If the text is just floating around in a DIV on the page, not as a part of an image or some other form hard to extract the string from, then it's more or less pointless. No bot would be stopped by that.
The jQuery .load function replaces the content of the target element - the element with the ID "target_div", in this case - with the results of whatever the specified URL returns. The setInterval makes that happen ever 300000 milliseconds; ever 5 minutes.
THis certainly sounds like a captcha. But it doesn't make much sense to me. A user has to wait 5 minutes for a new string? Or can they just refresh the page? Or open multiple tabs or windows?
Several times now you've asked for code or for people to just repeat stuff that's available on sites to which you've been given links. We don't mind helping you, but you've got to do the work yourself. Spoonfeeding won't make you a better programmer.