ok i have a CMS system ive built from scratch with some help from you guys but there is a problem i HAVE to overcome a prolem with selection boxes!!
the problem is as follows:
i have a page that allows admins to edit the config.php file via some text boxes:
page code:
<?php
session_start();
include "../config.php3";
$id = $_REQUEST['id'];
if ($_SESSION['usrlvl'] == 1)
{
echo"
<h2>SimpleCMS General Configuration</h2>
<form method='POST' action='config_edit.php3'>
<br>Database Server Address:<br>
<input name='server' value='$server' type='text'>(If database is on the same server as the site set this to localhost)<br>
<br>Name Of Database:<br>
<input name='dbname' value='$db' type='text'> (Unless you know what you are doing leave this as it is (YourDBPrefix_scms)<br>
<br>Database Username:<br>
<input name='dbuser' value='$user' type='text'> (Leave as it is (YourPrefix_scms)<br>
<br>Database Password:<br>
<input name='dbpass' value='$pass' type='text'><br>
<br>Site Name:<br>
<input name='site_name' value='$site_name' type='text'> This Will Appear In The Site Title<br>
<br>Content Table Name:<br>
<input name='content' value='$table1' type='text'>(Leave as default (scms_content) unless you know what you are doing)<br>
<br> Menus Table Name:<br>
<input name='menus' value='$table2' type='text'>(Leave as default (scms_menus) unless you know what you are doing)<br>
<br> Users Table Name:<br>
<input name='users' value='$table3' type='text'>(Leave as default (scms_users) unless you know
what you are doing)<br>
<br> Private Messages Table Name:<br>
<input name='prims' value='$table4' type='text'>(Leave as default (scms_pms) unless you know what you are doing)<br>
<br> Folder On Server SimpleCMS Resides In:<br>
<input name='folder' value='$folder' type='text'><br>
<br> http:// Address Of SimpleCMS:<br>
<input name='webaddy' value='$webaddress' type='text'> <br>
<br>Site Template: <b>Current Template: $template</b><br>";
include "templatelist.php";
echo "
<input type='submit' value='Save Changes'>
</form>
";
}
else
{
echo "<font color='red'><b>Sorry But It Appears That You Are Not Of A User Level With Sufficient Privelidges To Access This Page Or You Aren't Logged In!!</b></font>";
exit();
}
?>
The selection box is automaticaly populated with the templates via a script in templatelist.php which searchs for any directories within the template directory:
<select name='Template'>
<?
$absolute_path = "../Templates/";
$dir = opendir($absolute_path);
while ($file = readdir($dir))
{
if (($file != "..") && ($file != ".") && !strstr($file, '.php') && !strstr($file, '.html'))
{
echo "<option value=$file>$file</option>";
}
}
?>
</select>
problem is the Template Selection box automatticaly goes to the first option in the list not the current template?
how can i get it to automaticaly set the current tempalate as the checked one in the drop down box?
edit: Posted correct code or Templatelist.php