Page 3 of 3
Posted: Wed Oct 18, 2006 8:11 am
by Obadiah
feyd wrote:I'd supply additional pathing information either in the form as a separate element, or in the options themselves.
Basically, you need to store $dirname (stripped of the common part "resids/$_SESSION['logname']/")
ok....i took your advice and rewrote it this-a-way....
Code: Select all
<?php
$indent = str_repeat("\t", 5);
$dirname = "resids/{$_SESSION['logname']}/{$_POST['xyz']}";
$filename= "*.pdf";
if (!is_dir($dirname))
{
$dirname="{$_POST['xyz']}";
echo $indent . '<option>Invalid directory specified.</option></select><br>';
echo "<select name="abc">";
$dh=opendir($ob) or die("couldn't open directory");
while(!(($filea = readdir($dh)) === false))
{
echo"<option>$filea</option>";
}
echo "</select>";
}
else
{
$dh = opendir($dirname) or die("couldn't open directory");
while(($file = readdir($dh)) !== false)
{
if ($file != '.' and $file != '..')
{
echo $indent . '<option' . ((isset($_POST['xyz']) && $_POST['xyz'] == $file) ? ' selected="selected"' : '') . '>' . $file . '</option>' . PHP_EOL;
}
}
}
?>
cool thing is the second select will show...bad part is...its empty....i stored the value of xyz as a new value in the if....what do i do now? why does it ignore the while in this instance?
[edited]
i deleted all the posts leading up to this one because the thread started becoming a blog, and this is where im currently at in the project...any help will be greatly apprieciated
Posted: Wed Oct 18, 2006 2:43 pm
by Obadiah
ok...just a while ago i tried this....i was testing to see if the first part of my if was being blocked...and it was but i dont know why
Code: Select all
<pre><?php print_r($_POST); ?></pre>
<form method="post">
<div>
<select name="xyz">
<?php
$indent = str_repeat("\t", 5);
$dirname = "resids/{$_SESSION['logname']}/{$_POST['xyz']}";
$filename= "*.pdf";
if (!is_dir($dirname))
{
$dirname="{$_POST['xyz']}";
echo $indent . '<option>Invalid directory specified.</option></select><br>';
echo "<select name=\"abc\">";
echo "<pre>";
print_r($_POST);
echo "</pre>";
$dh=opendir($dirname) or die("couldn't open directory");
while(!(($file = readdir($dh)) === false))
{
if ($file != '.' and $file != '..')
{
echo $indent . '<option' . ((isset($_POST['abc']) && $_POST['abc'] == $file) ? ' selected="selected"' : '') . '>' . $file . '</option>' . PHP_EOL;
}
}
echo "</select>";
}
else
{
$dh = opendir($dirname) or die("couldn't open directory");
while(($file = readdir($dh)) !== false)
{
if ($file != '.' and $file != '..')
{
echo $indent . '<option' . ((isset($_POST['xyz']) && $_POST['xyz'] == $file) ? ' selected="selected"' : '') . '>' . $file . '</option>' . PHP_EOL;
}
}
}
?>
</select>
<input type="submit" name="submit" />
i saw one of my errors where i had $ob instead of dirname and i fixed that and im still here at square one...please help me

anyone
Posted: Thu Oct 19, 2006 10:13 am
by Obadiah
does php have problems reading the existance of php files...i tested something that a friend mentioned to me...in my previous pots i said that my applications had problems picking up the files located in the first folder i didnt know why....ok...what i did was i took a pdf file out of the last folder that wasnt displaying its contents and put it in the first folder(first testing my theory with a txt file) and the pdf shows up....why? has anyone else came in contact with this?....is there a way i can get it to show the files in that last folder....
here is another thing....i put a folder inside the last folder that wouldnt display its content and it didnt dispay it still....why wouldnt the process work reverse?