Note that there are some explanatory texts on larger screens.

plurals
  1. POOpen file to edit problems
    primarykey
    data
    text
    <p>Using <code>opendir</code> I am displaying a list of files in a folder. Each file is a <code>&lt;a href&gt;</code> link.</p> <p>I am trying to open a file in edit mode when name of the file is clicked but it seems that I hit a bump and can't get it to work. When I click a file it goes to the edit page but it is not selecting the file to be edited so it does not open.</p> <p>Can anyone advise me how I can select the file?</p> <p>This is my code to display all the files in the folder:</p> <pre><code>$directory = 'source'; if ($handle = opendir($directory. '/')) { echo 'Looking inside \''.$directory.'\'&lt;br&gt;&lt;br&gt;'; while ($file = readdir($handle)) { if ($file != '.' &amp;&amp; $file != '..') { echo '&lt;form method="post" action="file5.php"&gt;'; // echo '&lt;a href="'.$directory.'/'.$file.'" name="fileName"&gt;'.$file.'&lt;/a&gt;&lt;br&gt;'; echo '&lt;a href="file5.php" name="name"&gt;'.$file.'&lt;/a&gt;'; echo '&lt;/form&gt;'; } } } </code></pre> <p>and then in this part using include the file should open in edit mode:</p> <p><strong>EDIT</strong></p> <p>This is the rest of the form that i am using:</p> <pre><code> include filter_input(INPUT_POST, 'fileName', FILTER_SANITIZE_STRING); echo '&lt;form action="updatefile.php" method="post"&gt;'; echo '&lt;div class="create_field"&gt;'; foreach($_ as $part1 =&gt; $part2) { echo trim('&lt;p&gt;&lt;textarea name="content_prt1[]" rows="2" cols="50"&gt;'.str_replace($simbols, "",$part1).'&lt;/textarea&gt; &lt;textarea name="content_prt2[]" rows="2" cols="50"&gt;'.str_replace($simbols, "",$part2).'&lt;/textarea&gt;&lt;/p&gt;'); } echo '&lt;/div&gt;'; echo'&lt;input type="button" id="button" value="Create New Element"/&gt;'; ?&gt; &lt;input type="hidden" name="file_name" value="name"&gt; &lt;?php echo '&lt;input type="submit" value="Submit" name="submit"&gt;'; echo '&lt;input type="submit" value="Exit" name="Exit"&gt;'; echo '&lt;form /&gt;'; ?&gt; </code></pre> <p>tnx for the help in advance</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload