Code: Select all
<?php
$connection = mysql_connect("server","user","pass");
$db=mysql_select_db("db", $connection);
$furniture = "SELECT furniture FROM items";
$sql = mysql_query($furniture) or die(mysql_error());
while ($row = mysql_fetch_array($sql))
{
echo "<input type=\"radio\" name=\"web\" value='".$row['furniture']."'>".$row['furniture']."</input>";
}
$furn = $_POST['web'];//The problem??
$dir = $furn."/upload";
echo "<br /><select name=\"up\">";
if(file_exists($dir))
{
if($dh=opendir($dir))//Opening directory
{
if(($dhf = scandir($dir)) && (count($dhf) == 2))
{
echo "<option value=\"empty\">Directory is empty!</option>";
}
else
{
while (($sd = (readdir($dh))) !== false)//while the directory being read is
{
if($sd != "." && $sd != "..")
{
echo "<option value='".$sd."'>".$sd."</option>";
}
}
}
}
}
echo "</select>";
echo"<br />If your can find the type of furniture you are looking for create a new one:";
echo"<br /><input type=\"text\" name=\"newFolder\" />";
?>
Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Upload File</title>
</head>
<body>
<form action="upload.php" method="post" enctype="multipart/form-data">
<input type="hidden" name="MAX_FILE_SIZE" value="104857600" />
File:<input type="file" name="file" /><br />
<?php include 'form.php'; ?><br /><!--lists furniture depending on type-->
<input type="submit" name="submit" />
</form>
</body>
</html>
Any help would be apprieciated. Thanks,
Stow