View Full Version : I'm feeling lucky...

06-17-2004, 03:00 AM
Hi, and thanks for a well written script :)

I was wondering if it was possible to add a "I'm feeling lucky" botton to the search form, like google uses.

It don't have to be a button, but is there a way to pop-up a window where the user automaticly is taken to the nr 1. search result url?

Thanks for all help...

06-19-2004, 06:05 AM
Hi. One way do it this would be to pass a variable $feeling_lucky to search_function.php and then after the following code:

if ((is_array($final_result)) && (count($final_result) > 0)) {

add something like the following:

if ($feeling_lucky == true) {
// query database to get number one $lucky_site
header("Location: $lucky_site");