Please run the code from bellow. get suggest with following data - keyword: car Depth: 2 In the result, there prints a 'Download' link after each 10 lines. But I want only one 'Download' link at the end of last line. Also need a variable that contain all resulted lines together. (I will send that variable to another page) PLEASE HELP ME Here is the full code of my file. <?php // Author: Md. Kamrul Hasan ?> <center><br> <form action="" method="post"> Keyword : <input name="kw" type="text" size="50" value="<?php echo strip_tags($_POST['kw']); ?>" /> <!-- Langue : <select name="lang"> <option value="fr">FR</option> <option value="en">EN</option> <option value="es">ES</option> </select> --> Depth : <select name="depth"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> </select> Sort : <input type="checkbox" name="sort" value="1"> <br /> <br /> <input type="submit" value="Suggest" /> </form> </center> <?php if(isset($_POST['kw'])){ $kw = strip_tags(utf8_encode($_POST["kw"])); //$lang = strip_tags($_POST["lang"]); $lang = "en"; if($lang == '') $lang = "en"; $depth = strip_tags($_POST["depth"]); if($depth == '') $depth = "1"; ggSuggest($kw, $lang, $depth); } function ggSuggest($kw, $lang, $depth = 1, $inc = 1){ global $tabKw; $tabKw[] = $kw; $url = 'http://www.google.co.uk/complete/search?hl='.$lang.'&js=true&qu='. urlencode($kw); if (function_exists('curl_init')) { $header = array( "Accept: text/xml,application/xml,application/xhtml+xml, text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5", "Accept-Language: fr-fr,fr;q=0.7,en-gb;q=0.5,en-gb;q=0.3", "Accept-Charset: utf-8;q=0.7,*;q=0.7", "Keep-Alive: 300"); $ch = curl_init(); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_VERBOSE, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5); curl_setopt($ch, CURLOPT_TIMEOUT, 5); curl_setopt($ch, CURLOPT_REFERER, 'http://www.google.com/'); curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)' ); curl_setopt($ch, CURLOPT_HTTPHEADER, $header ); curl_setopt($ch, CURLOPT_URL, $url); $result=curl_exec ($ch); curl_close ($ch); } else { $result= file_get_contents($url); } preg_match_all('/\["(.*?)",/si', $result, $kwgoogle, PREG_SET_ORDER); if ($kwgoogle=='' || $inc > $depth) { return $tabKw; }else { $sort = $_POST['sort']; if ($sort == 1) { sort($kwgoogle); } foreach($kwgoogle as $v){ $tk = utf8_decode(strip_tags($v[1])); if(!in_array($tk, $tabKw)){ //echo "<center><table border=1 width='80%'><tr><td>" ; echo $tk.'<br />'; $tks .= $tk.'<br>'; flush(); ggSuggest($tk, $lang, $depth, $inc+1); //echo "</td></tr></table>"; } $tkss .= $tks; } echo "<a href=\"csv.php?data=$tks\">Download</a><a href=\"csv.php?data=$tkss\">Download</a><br>"; } return $tabKw; } ?> PHP: