PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
hey i am brand new to php and i have what could very easily be a stupid question.
i am using random quote generator to implement in my new website, and i would like to make it easy for the user to randomly come up with another quote (without having to refresh the page). is this even possible?
it would be nice if there was some way i could do it through a simple HTML link.
thanks
(i have included the code for the generator here - much of it is from a tutorial i found on evilwalrus.com)
You put that function in an include file, and simply refresh the include file. I am not sure if that'll refresh your whole page or not. You might also want to try and work with frames. Here's my include idea:
You can use frames or JavaScript. JavaScript is the best way to do this if you don't want to refresh the page and don't want to play around with frames.
I seem to recall being about to set a refresh value in the http header.
So call header () with some time value. Sorry, I don't remember the exact syntax and I am too lazy to look it up.
Javascript will work too. Basically you need to put something in the html/javascript which will force it to issue another get or post so that you can generate a new quote.