Hello.
I'v got two php pages. index.html wich includes all other pages into it. And table.html wich list out words from a mysql table and links the words to audio files for playback.
Here is the index.html file :
<head><link rel="stylesheet" type="text/css" href="style.css"></head>
<?php
$id = $_GET['id'];
$dir = opendir('.'); # Dir to open
print "<div id=cont><div id=logo><a class=l href=./>Home</a></div>";
print "<div id=nav>";
if($id) { print "<a class=l href=./>Home</a> | "; }
else { print "<a class=a href=./>Home</a> | "; }
while ($file=readdir($dir)) { #Loop through dir for files
if ($file=="."||$file==".."||ereg("style|home|index",$file)) { } # Exclude
else { $sortfiles[]=$file; } # Put files into array for sorting
}
closedir($dir);
sort($sortfiles);
foreach($sortfiles as $file) { # Title navigation
if($file==$id) {
print "<a class=a href=index.html?id=$file>".substr($file,0,-5)."</a> | ";
} else {
print "<a class=l href=index.html?id=$file>".substr($file,0,-5)."</a> |";
}
}
print "</div>";
print "<div id=left>Ken<br>Maria<br>Anna<br>Peter</div>";
print "<div id=title>";
print substr($id,0,-5);
print "<hr></div>";
print "<div id=content>"; #Left side
if($id) {
include("$id");
} else {
print "Intro to Win";
}
print "</div>";
print "<div id=right>Pictures</div></div>";
?>
And here is the table.html :
<?php
mysql_connect("localhost", "user", "pass") or die("Could not connect: " . mysql_error());
mysql_select_db("database");
$result = mysql_query("SELECT * FROM table");
print "<table border=1><tr><td colspan=4 bgcolor=79A2CE>Table</td></tr>";
while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
print "<tr>";
print "<td><a href=index.html?id=audio/$row[0].mp3>$row[0]</a></td>";
print "<td><a href=index.html?id=audio/$row[1].mp3>$row[1]</a></td>";
print "<td><a href=index.html?id=audio/$row[2].mp3>$row[2]</a></td>";
print "<td>$row[3]</td>";
print "</tr>";
}
print "</table>";
mysql_free_result($result);
?>
I don't know why but I get the following error messages when I try to click on a word listed out from the table.html
Warning: Unexpected character in input: '' (ASCII=15) state=1 in /var/www/winkurs/test/audio/bor.mp3 on line 7
Parse error: syntax error, unexpected '[' in /var/www/winkurs/test/audio/bor.mp3 on line 7
It works if I in the table.php file link like this :
print "<td><a href=audio/$row[0].mp3>$row[0]</a></td>";
but not like this :
print "<td><a href=index.html?id=audio/$row[0].mp3>$row[0]</a></td>";
I would like to keep pages viewed in the index.html file if possible, and not have to leave the navigation system.
Any ideas ?