Good Day Everyone Ok, so I have done as much as I understand and need some direction and help. Currently i'm very new to html/php so please bear with me. The plan is to list the text files from a Dir in a dropdown list, this I have done, now I would like to display the text file in the same page in a table upon submit button press. This is what I have so far, any input welcome as I am still learning! The bash script is just a grep function to grab specific lines from the original file and copy it to /tmp. Thanks Again
<html>
<head>
<title>Data Request</title>
</head>
<body>
<h1 align="center">Dispatch Report</h1>
<h2 align="center">Wrong Arrives Report</h2>
<table align="center" border="2">
<tr>
<td>Select Shift<br>
<form name="shiftfrm" id="shiftfrm">
<select name="shiftlist" id="shiftlist">
<option value="" selected="selected">--------</option>
<?php
$dir = opendir ("/var/www/files/");
while (false !== ($file = readdir($dir))) {
if (strpos($file, '.txt',1)) {
echo '<option value="' . $file . '">' . $file . '</option>';
}
}
?>
</select>
<input type="submit" id="submit" value="Submit"/>
<?php
if( ($handle = fopen( '/tmp/sh130418n.txt', 'r' )) !== false )
{
$output = '<table align="center" width="" border="2">';
while( ($data = fgetcsv( $handle )) !== false )
{
$output .= '<tr>';
foreach( $data as $value )
{
$output .= sprintf( '<td>%s</td>', $value );
}
fclose( $handle );
$output .= '</table>';
}
echo $output;
?>
</td></tr>
</table>
<?php
$output = exec('/var/www/cgi-bin/manualexceptget.sh');
echo "<pre>$output</pre>";
?>
</body>
</html>