PHP: fwrite problems

Hi, Im trying to have a url written to a textfiel via the “fwrite”-command in php.

I also dont want to type “http://” every time I input a link, so that should be included in the php-code.


fwrite($FilePointer, "<a href=\"http://".$LinkOne."\" target=\"blank\">".$LinkNameOne."</a> <BR>" );

This should result in a nice HTML-coded url when “www.myLink.com” is sent by the $LinkOne-variable, but instead I get:


<a href="www.myLink.com" target="blank">myLink</a>

That is, everything but the actual “http://”.

Where am I going wrong here?

what you should do is this:


fwrite($FilePointer, $LinkOne .".:-:.". $LinkNameOne);

and then when you print that out just add the http:// to the PHP code…

something like this:


$textFile = "myTextFile.txt";
$filePointer = fopen($textFile, "a+");
$data = split(".:-:.", $fread($filePointer, 80000));
fclose($filePointer);

print "<a href=\"http://" . $data[0] . " target=\"_blank\">" . $data[1] . "</a> <br />";


something like that…

[edit]oh, and I tried your code, and it worked fine for me…[/edit]