Hi everyone. I just started working with php the other day, it seems to be much more powerfull then any online language I've ever worked with.
I'm haveing some trouble with a file tho. I'm trying to add a link to the top of an html file. I've tried all the methods that I can think of to do ths, but I'm still stumped. The format for my links are as follows.
<li><a href="http://www.whatever.com">Clickable Text</a><br>
I can get it to add it to the bottom with an append statement, but it overwrites the top of the file with an r+ statement.
Thanks for any help you guys can give me.
if($action == "true")
{
$file_contents = file("$file_directory/$file_name[$niche]");
$sizeof = count("$file_contents");
if($filehandle = fopen("$file_directory/$file_name[$niche]", "r+"))
{
fputs($filehandle, "<li><a href=$gal>$title</a><br>\n");
fclose($filehandle);
echo("<center>Added $title to $file_name[$niche]</center>");
}
else
{
echo(@error);
}
}
That is what I have for the PHP section of the code. I have a nifty little table as well, but that seems to be working just fine. There are several arrays which are also working just fine. My only real trouble is getting that darn link to the top of the file 😕