Jump to content

pass variable from one php file to another without using form.....pls help..


paparanch

Recommended Posts

wazup guyz!

i have another problem regarding varaibles...how could i pass the value of a variable from one php to another external php file without any form?

well, this is the situation....i have here the code from my gallery.php...and i wanted to pass the variable $file to get the filename of every picture i have in my folder....

 

 

//code from gallery.php

 

<?php

Header("content-type: application/x-javascript");

function returnimages($dirname=".") {

  $pattern="\.(jpg|jpeg|png|gif|bmp)$";

  $files = array();

  $curimage=0;

  if($handle = opendir($dirname)) {

      while(false !== ($file = readdir($handle))){

              if(eregi($pattern, $file)){

$filedate=date ("M d, Y H:i:s", filemtime($file));

                echo 'galleryarray[' . $curimage .']=["' . $file . '", "'.$filedate.'"];' . "\n";

$curimage++;

              }

      }

      closedir($handle);

  }

  return($files);

}

echo "var galleryarray=new Array();" . "\n";

returnimages();

?>

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.