Jump to content

[SOLVED] passing on variable does not go well


muckv

Recommended Posts

When I pass the variable (string) I can not display it in another .php file

 

 

 

In here I pass the var

		for($i=0;$i<$max;$i++){


		echo '<A HREF="http://localhost/IPTC/inhoud.php?var='.$dirs[$i].'">'.$dirs[$i].'</A><br>';
		$temp= get_images_in_subdir($dirs[$i]);
		if($temp!= null){$images[]=$temp;}



	}

 

here I want to display it but it's a blank page when executed,

 

<html>
<head>
<title>Inhoud</title>
</head>

<?


echo $var;
?>
</html>

 

Can somebody see the error?

PHP Version 5.2.5

 

 

 

Configure Command  cscript /nologo configure.js "--enable-snapshot-build" "--with-gd=shared" 

Server API  CGI/FastCGI 

Virtual Directory Support  enabled 

Configuration File (php.ini) Path  C:\WINDOWS 

Loaded Configuration File  C:\Program Files\phpDesigner 2008\PHP\php.ini 

PHP API  20041225 

PHP Extension  20060613 

Zend Extension  220060519 

Debug Build  no 

Thread Safety  enabled 

Zend Memory Manager  enabled 

IPv6 Support  enabled 

Registered PHP Streams  php, file, data, http, ftp, compress.zlib, zip 

Registered Stream Socket Transports  tcp, udp 

Registered Stream Filters  convert.iconv.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, zlib.* 

 

http://localhost/IPTC/index.php      From here I make the url going to

 

http://localhost/IPTC/inhoud.php?var=jan                          (jan is the correct value)

 

print_r($_REQUEST) in inhoud.php gives me no output

 

I will post all my relevant code

 

<?php

include("directory.php");





$rootfolder = new folder('.');

global $dirs;

$dirs=$rootfolder->scanfdir();

$max=sizeof($dirs);





for($i=0;$i<$max;$i++)
{
//$dirs[] is full of strings, checked and working
echo '<A HREF="http://localhost/IPTC/inhoud.php?var='.$dirs[$i].'">'.$dirs[$i].'</A><br>';
}

?>

 

 

<html>
<head>
<title>Inhoud</title>
</head>
<body>

<?


$var =$_GET['var'];

echo $var;

print_r($_REQUEST);

$path = './IPTC/'.$var;

function check_extension($extensie){

	 ($extensie == 'jpg' || $extensie == 'jpeg' || $extensie == 'gif')? true : false;

}	

function get_images($path){
	$files = scandir($path);
	for($i = 0;$i < sizeof($files);$i++) {
		$ext  = substr($files[$i], strrpos($files[$i], '.') + 1);

		if(check_extensie($ext)){
			$string .= $files[$i].' ';


		}

	}
	return $string;
}





?>
</body>
</html>

 

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.