I have closed the brakets. { }.. but i'm getting some errors:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /customers/test-dig.dk/test-dig.dk/httpd.www/dik/select_audio.php on line 27
Warning: in_array() [function.in-array]: Wrong datatype for second argument in /customers/test-dig.dk/test-dig.dk/httpd.www/dik/select_audio.php on line 43
Please remember that this is a php, how upload and save a dictations..
Can anyone see what sud be.. or i've got to make a sql table of some cane...
<?
require("database.inc.php");
{connectDatabase();}
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Vælg lyd til <?=$_POST['title']?></title>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<? if(file_exists("text/".$_POST['title'].".txt")) {
?>
<h1>Vælg lyd</h1>
<h3 style="color:#CC3333">Pas på! Der findes allerede et diktat med denne titel.<br />
Hvis du er ved at lave et nyt diktat, burde du gå <a href="javascript:history.back()">tilbage</a> og vælge en anden titel.
Gør du ikke det, bliver diktatet med titelen "<?=$_POST['title']?>" erstattet med dette diktat her!</h3>
<?
}
?>
<form enctype="multipart/form-data" action="save_dict.php" method="post">
<input type="hidden" name="MAX_FILE_SIZE" value="500000" />
<table border="0">
<?
$result=mysql_query("SELECT word FROM repository;");
while($entry=mysql_fetch_array($result)) {
$repository[]=$entry[0];
}
$word_start=0;
$word_stop=0;
$open=false;
$words=array();
$content=$_POST['content'];
for($i=0;$i<strlen($content);$i++) {
if(substr($content,$i,1)=="<" && !$open) {
$word_start=$i+1;
$open=true;
}
elseif(substr($content,$i,1)==">" && $open) {
$word_stop=$i;
$word=substr($content,$word_start,$word_stop-$word_start);
if(!in_array($word,$repository)) {
$words[]=$word;
?>
<tr>
<td><?=$word?></td>
<td><input type="file" name="<?=$word?>" /></td>
</tr>
<?
}
$open=false;
}
}
?>
</table>
<input type="hidden" name="words" value="<? echo implode(";",$words); ?>" />
<input type="hidden" name="content" value="<?=$_POST['content']?>" />
<input type="hidden" name="title" value="<?=$_POST['title']?>" />
<input type="submit" value="Upload & save" />
</form>
</body>
</html>