I am using a PHP webpage to give me a list of all files with a .264 extension in a specific folder. Then the file is selected and sent to the team to play the video on the screen attached to the computer.
I'm having difficulty trying to get the switches to maintain their values, so when they are selected and the form button is pressed, they don’t know their values and therefore can’t execute the script.
I know the script works because I tested it only with the fill form in the empty form and had no problems.
Now I am listing the files using the switch to select the file and submit it to the form for playback, but it does not work as I hoped.
I looked around and tried to figure it out. I'm not sure if I need to use a linked list or something instead of an array. This is my first time I'm doing php coding, so I'm not sure where I should try to resolve this.
<?php $FileCount = 0; $currentdir = '/data/'; //Location of Hard Drive $dir = opendir($currentdir); $array = array(); echo '<ul>'; while ($File = readdir($dir)){ //if (is_file($file)) $ext = pathinfo($File, PATHINFO_EXTENSION); if ($ext == '264'){ $array[] = "$File"; echo "<INPUT class='radio' type='radio' name='FileName' value='$File' /> <span>$File</span><p>"; $FileCount++; } } echo '<form action="test.php" method = "post">'; echo "<INPUT TYPE = 'Submit' name = 'FormSubmit' value = 'Submit'>"; echo '</form>'; if ($_POST['FormSubmit'] == "Submit") { echo $_POST["FileName"]; }
Nothing returns with this code. Any help would be great. Thanks.
source share