You are here: Re: Populate picklist from directory and return file name « PHP Programming Language « IT news, forums, messages
Re: Populate picklist from directory and return file name

Posted by sunbum on 09/14/05 20:27

Sorry for replying to my own post.

Here is the latest version and I think it's closer.

Can someone help me clean up the syntax?

Thanks!
------- Code begin (this is NOT in the script ------------------

<?php
if (isset($_POST['file']))
{
// process the data, see if it's valid.
// if it's valid and you're satisfied, do whatever you want with
the data
// if not, start outputting the form

$file = "/inetpub/wwwroot/templogs/"+$_POST['file'];
// Display the Graph
displaygraph();
}

else {
// display the form
displayform();
}

<?php
function displaygraph() {
echo "So far so good, this would draw graph with $file";

}


?>

<?php
function displayform() {


<form name="cooler" action="<?php $server['PHP_SELF']?>"
method=\"post\">";
$dir = "/inetpub/wwwroot/templogs/";

echo "<select name='file'>";
$dir = opendir($dir);
while (false !== ($file = readdir($dir))){
if (in_array($file, array(".", ".."))) continue;
print "<option value='$file'>$file</option>";
}
</select>;


<input type="submit" value="Submit">;
</form>

}


?>


?>

------- Code end (this is NOT in the script ------------------

Mike

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация