PhpDig.net

Go Back   PhpDig.net > PhpDig Forums > How-to Forum

Reply
 
Thread Tools
Old 06-17-2004, 03:00 AM   #1
staura
Green Mole
 
Join Date: Jun 2004
Posts: 3
I'm feeling lucky...

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...
staura is offline   Reply With Quote
Old 06-19-2004, 06:05 AM   #2
Charter
Head Mole
 
Charter's Avatar
 
Join Date: May 2003
Posts: 2,539
Hi. One way do it this would be to pass a variable $feeling_lucky to search_function.php and then after the following code:
PHP Code:
if ((is_array($final_result)) && (count($final_result) > 0)) {
    
arsort($final_result); 
add something like the following:
PHP Code:
if ($feeling_lucky == true) {
    
// query database to get number one $lucky_site
    
header("Location: $lucky_site");
    exit();

__________________
Responses are offered on a voluntary if/as time is available basis, no guarantees. Double posting or bumping threads will not get your question answered any faster. No support via PM or email, responses not guaranteed. Thank you for your comprehension.
Charter is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 03:27 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright © 2001 - 2005, ThinkDing LLC. All Rights Reserved.