Jump to content

Recommended Posts

I have an html table that is being populated with links from a specific directory..

 

I would like the user to be able to click the link and if its a file they will download the file. If its a directory, I woudl like to reload the current page but this time show the contents of the directory.

 

My main issue is that I have a session variable called 'workingdirectory' that I need to update before I reload the page. I have tried setting it and then calling Location('page.php') but I get the 'cannot change header information' error. I realized I was getting this because I had begun to call HTML code before the PHP was finished. Is there a way to just simply update the session variable, and then make the page reload when the user clicks on a link?

 

 

Thank you,

 

That does the job! I was hoping to use a session though so the directories were not listed in URL. Is there a way to just reload the page after setting a session variable? I am just drawing a blank and admittedly not the best with php yet :(

 

I had my conditional line calling a function if a directory was found:

 


<a href=" <?php ChangeFolder($file) ?>"> directory name here</a>




<?php


function ChangeFolder($file)
{
      $_SESSION['workingfolder'] = $_SESSION['workingfolder']."/".$file;

     *** refresh page or reload page here***
}

?>

 

 

I just cant for the life of me figure out the simple way to reload the page :/

 

Once again thank you though for your solution..

 

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.