Hi. I have a little script. Basically it is a buzzcloud emulator. What it does: Input an URL and a keyword list. Example www.psp.com and a psp related keyword list. The script outputs: <a href="http://www.psp.com/psp+downloads">psp downloads</a><a href="http://www.psp.com/free+psp+downloads">free psp downloads</a><a href="http://www.psp.com/free+psp+game+downloads">free psp game downloads</a><a href="http://www.psp.com/psp+game+downloads">psp game downloads</a><a href="http://www.psp.com/psp+movie+downloads">psp movie downloads</a> Code (markup): This is the script: <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> </head> <body> <?php $url=$_GET['url']; $code = null; $filename = $_GET['txt']; // the name of the txt file if ($url != null) { if (!$fp=fopen($filename,"r")) $code = $filename." not found."; // if not found display a message else { while (!feof($fp)) { $buffer = trim(fgets($fp, 4096)); $buffer_ad = strtr($buffer," ","+"); $code .= "<a href=\"" . $url . $buffer_ad."\">".$buffer."</a>"; } fclose ($fp); } } ?> <form action="buzzcloud.php" method="get"> <!-- LINE 25: change this line if you want to rename the source code file --> <input name="url" type="text" /> url<br /> <input name="txt" type="text" /> txt<br /> <input type="submit" value="Generate" /><br /> <textarea rows="15" cols="60" ><?php if ($code != null) echo $code; ?></textarea> </form> </body> </html> Code (markup): The problem: It outputs all keywords without any space between them. How do I change the script to add a space after every keyword?
I guess you should change this line to $code .= "<a href=\"" . $url . $buffer_ad."\">".$buffer."</a><br>"; PHP: to make a linebreak between each line