Re: calling a function in the same page
| From: | Sumeet | Date: | Mon, 25 Dec 2006 10:51:37 +0000 |
| Subject: | Re: calling a function in the same page | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-246205@lists.php.net to get a copy of this message | ||
Jahangir wrote:
I am trying to call a function from "a href" inside the same page. this is the code: echo "<br><br><a href=\"isearch($query)\">More results from Mysite</a>"; // calling the function isearch function isearch($query) {$query=urlencode($query); $request='http://api.search.yahoo.com/WebSearchService/V1/webSearch?appid=Ja hangir&query=' .urlencode($query). '&output=php&results=100&site=mysite.com; $response=file_get_contents($request); if ($response === false) { die('Request failed');} $phpobj=unserialize($response); $count=$phpobj["ResultSet"]["totalResultsReturned"]; if($phpobj["ResultSet"]["totalResultsAvailable"]==0) {echo "<br>NO RESULTS TO DISPLAY"; }add a 'die;' here.. like { echo "<br>NO RESULTS TO DISPLAY"; die; } -- Thanking You Sumeet Shroff http://www.prateeksha.com Web Designers and PHP / Mysql Ecommerce Development, Mumbai India