well after a few hours of deep thought i got it, thank you for pushing me in the right direction
Finished Code:
PHP Code:
include("config.php");
// Create array here
echo "<select name='t_title'>";
$themelist = array();
$dir = "../demo/themes/";
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== false) {
if(file_exists("../demo/themes/$file/theme.php")){
array_push($themelist, $file); // Add value to array
}
}
closedir($dh);
}
}
$dbThemeList = array();
$q = "SELECT * FROM nuke_theme_preview";
$result = mysql_query($q) or die ('Something is wrong with query: ' . $q . '<br>'. mysql_error());
while ($row = mysql_fetch_assoc($result))
{
array_push($dbThemeList, $row['t_title']); // Add value to array
}
$newThemes = array_filter($themelist, create_function('$elt', 'return !in_array($elt,' . var_export($dbThemeList, true) . ');'));
for ($i=0; $i < sizeof($themelist); $i++) {
if($newThemes[$i]!=""){
echo "<option value='" . $newThemes[$i] . "' name='t_title'>" . $newThemes[$i] . "</option>";
}
}
echo "</select>";