Hey all im new to PHP and im needing some help solving a problem.
Im using a script for a guestbook thats PHP and when a new entry is posted the newest entry goes to the bottom of the list instead of the top the way u would think it would.
Heres the PHP script.

PHP Code:
<?

if (!isset($name) || !isset($email) || !isset($message) || empty($name) || empty($email) || empty($message)) {
print 
"&result=Fail";
print 
"&errorMsg=" urlencode("Input required for all fields.");
exit;
}

$email strtolower($email);

addentry($name$email$message);

function 
addentry($name$email$message) {

$posted strftime("%D %I:%M %p");

$message stripslashes($message);

$file fopen('entry.txt''a+');

if (!
$file) {
print 
"&result=Fail";
print 
"&errorMsg=" urlencode("Could not open entry.txt file. Change CHMOD levels to 766.");
exit;
}

fputs($file"<font color=\"#FFFFFF\">Name:</font> $name\n<font color=\"#FFFFFF\">Email:</font> <font color=\"#990000\"><u><A href=\"mailto:$email\">$email</A></u></font><br>\n<font color=\"#FFFFFF\">Posted:</font> $posted\n<font color=\"#FFFFFF\">Message:</font> $message\n\n");
fclose($file);

// Send admin an email when new entry occurs
mailAdmin($name$email$message);
}

function 
mailAdmin($name$email$message) {
 
$mailTo "you@youremail.com";
 
$mailFrom "From: <you@youremail.com>";
 
$mailSubject "New Guestbook Entry";
 
$mailBody "A visitor to your site has left the following information in your guestbook:\n
 Name: 
$name
 Email: 
$email
 The visitor commented:
 ------------------------------
 
$message 
 ------------------------------
 You can view the message at:
 [url]http://www.yoursite.com[/url]"
;
 
mail($mailTo$mailSubject$mailBody$mailFrom);
}

print 
"&result=okay";
exit;

?>
Now i really cant work out what part of the script controls the order the posts are viewed. Could someone help me work this out ?? Im sure its something simple that im missing here.

Thanks in advance, Mental