muckv Posted October 31, 2008 Share Posted October 31, 2008 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? Quote Link to comment Share on other sites More sharing options...
Gulsaes Posted October 31, 2008 Share Posted October 31, 2008 well the first option would be to declare $var as a Global, otherwise i'd say easiest would be to put your "for" code into a function then call that function from the other page where you wish to display it.... Quote Link to comment Share on other sites More sharing options...
muckv Posted October 31, 2008 Author Share Posted October 31, 2008 make $var global? it's a variable I create when passing it the other page where I want to use it? doesn't work Quote Link to comment Share on other sites More sharing options...
blueman378 Posted October 31, 2008 Share Posted October 31, 2008 first question, possibly short open tags creating errors? 2nd: possibly error reporting turned off? Quote Link to comment Share on other sites More sharing options...
muckv Posted October 31, 2008 Author Share Posted October 31, 2008 well if I look at the url after I clicked the link I see http://url/inhoud.php?var=string so I see that $var has gotten it's correct value Quote Link to comment Share on other sites More sharing options...
Gulsaes Posted October 31, 2008 Share Posted October 31, 2008 $var =$_GET['var']; echo $var; Quote Link to comment Share on other sites More sharing options...
muckv Posted October 31, 2008 Author Share Posted October 31, 2008 nope doesn't work either Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted October 31, 2008 Share Posted October 31, 2008 Please tell us what version of PHP you're running. Upload a file containing <?php phpinfo(); ?> and invoke it. Ken Quote Link to comment Share on other sites More sharing options...
muckv Posted October 31, 2008 Author Share Posted October 31, 2008 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.* Quote Link to comment Share on other sites More sharing options...
muckv Posted October 31, 2008 Author Share Posted October 31, 2008 anyone? Quote Link to comment Share on other sites More sharing options...
samshel Posted October 31, 2008 Share Posted October 31, 2008 1) Please post HTML of the URL from where you are redirecting. 2) put print_r($_REQUEST) in inhoud.php and post the result. Quote Link to comment Share on other sites More sharing options...
muckv Posted October 31, 2008 Author Share Posted October 31, 2008 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> Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted October 31, 2008 Share Posted October 31, 2008 Change the "<?" in the file inhoud.php to "<?php". You probably have short tags turned off in the php.ini file. Ken Quote Link to comment Share on other sites More sharing options...
muckv Posted October 31, 2008 Author Share Posted October 31, 2008 geez thanks ken, you really helped me out thanks Quote Link to comment Share on other sites More sharing options...
blueman378 Posted November 4, 2008 Share Posted November 4, 2008 Change the "<?" in the file inhoud.php to "<?php". You probably have short tags turned off in the php.ini file. Ken lol i said that right at the start... but nobody listens to someone with no rank Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.