Jump to content

passing variable from an index.php?Myfoldername


gibbo1715

Recommended Posts

All

 

This is driving me nuts and im sure it sould be very easy

 

Basically im running an index page that has in include to a page content.php

 

What i want to do is hyperlink to the index page in the following way index.php?folderlocation

 

and pass the variable folderlocation to the include file content.php so i can tell the index page what path to goto to get the contentsw of a folder on my server

 

Im trying to do a photo gallery with text using iframes with content dynamically added based on the folder where the files are, in this case  the folder is content, i.e. index.php?content

 

heres my code, if someone can assist i will be very greatfull, appologies if its something relly simple, im new to php so still learning (slowly :shrug:)

 

Thanks

 

Gibbo

 

 

Content file

 

 

<?php 
$v1 = $_GET['variable1Name'];
$handle = opendir('./content/'); 
while (false !== ($file = readdir($handle))) { 
if ($file != "." && $file != "..") { 
echo "<div class='contentdiv'><iframe SRC=\"$file\" width=\"100%\" height=\"100%\" frameborder=\"0\">If you can read this your browser does not support iframes.</iframe></div>";
echo CONTENT; 
} 
}
closedir($handle); 
?>

 

my index file just has the include as follows

 

 

<?php 
  
include("content.php"); 


?>

 

 

 

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.