i'm still wondering why don't you put the :
echo "$var"; after the for section ...
it would be like this ...
for($i = $dat; $i < $pages ; $i++)
{ $anything=$anything+$var2;
echo "$anything";
$var=$var+$var2; }
echo "$var";
this works for sure ... please don't complicate everything ... and forget about the "goto" .. it sucks ...