Another Flash and PHP question :P

Alright, so here’s my current dillema; I have already existing PHP scripts and the like set up for my website, although I wasn’t the one in charge of PHP. Now then, our webmaster has since left, and we’re trying to pick up the pieces. Luckily, we’ve found another PHP savvy person to get things up and running with the grooviness. Now, from what I could see from the already existing PHP, it would not transfer over very well to Flash, so what we did was write a seperate PHP script to make the already existing scripts into something Flash could read and display properly in the text boxes… using this here script:

 <?php
function directory($dir)
{
 $handle=opendir($dir);
 $files=array();
 while( ($file = readdir($handle))!=false)
 {
  $files[] = $file;
 }
 closedir($handle);
 
 unset($files[0]);
 unset($files[1]);
  
 sort($files);
 return $files;
}

$news_dir = "news/";
$news = directory($news_dir);
$news_count = count($news) -1;
include("../layout/mechanics/functions.php");
(isset($_GET['prev'])) ? $prev = $_GET['prev'] : $prev = 0;
if($prev > $news_count) $prev = $news_count;
$i = $news_count - $prev;
  include($news_dir . $news[$i]);
  $postTime = obtain_time($news[$i]);
  $postDate = obtain_date($news[$i]);
  $postAuthor = obtain_poster($news[$i], "modeAuthor");
  $postEmail = obtain_poster($news[$i], "modeEmail");
  $postSig = obtain_poster($news[$i], "modeSig"); 
  $postText = trim($postText);
print "time=$postTime&date=$postDate&author=$postAuthor&email=$postEmail&title=$postTitle&text=$postText";
?> 

Now, here’s where it starts to get a little tricky. We can get it to load properly into Flash with the LoadVars() function from that… it’d be something like… h**p://www.webaddress.com/blah/readnews.php, and Flash can take that in from the variables displayed in the PHP. I have two questions to ask from this:

  1. There are multiple newsposts in there, and I would like to set up buttons in flash to go back through previous newsposts for archiving sake. The webaddress would be something like… hp://www.webaddress.com/blah/readnews.php?prev=150 or [url=“http://www.webaddress.com/blah/readnews.php?prev=17”]hp://www.webaddress.com/blah/readnews.php?prev=17 or what have you. How would I set it up in a button to go back and forth through the different newsposts?

  2. As a LoadVars() function, I realize that it doesn’t work the same as loading in a regular text document… my concern with this is whether or not html code like <a href> and the like will work. Is there a solution to this?

If I’m not explaining everything very well, just let me know, because I realize I’m not the best at explaining things -_-;; . Any help on this would be greatly appreciated.