magnoliazz Posted January 26, 2010 Share Posted January 26, 2010 I'm having a problem with php scripts, whenever there's a ' > ' operator, what comes after is displayed as text. For example : <?php if( isset($_SESSION['ERRMSG_ARR']) && is_array($_SESSION['ERRMSG_ARR']) && count($_SESSION['ERRMSG_ARR'])> 0 ) { echo '<ul class="err">'; foreach($_SESSION['ERRMSG_ARR'] as $msg) { echo '<li>',$msg,'</li>'; } echo '</ul>'; unset($_SESSION['ERRMSG_ARR']); } ?> displays the following on the page: 0 ) { echo ' * '; foreach($_SESSION['ERRMSG_ARR'] as $msg) { echo '',$msg,' '; } echo ' '; unset($_SESSION['ERRMSG_ARR']); } ?> I just don't get it, do I have to change the settings? or am I doing something wrong? why does it consider the '>' operator as the start of a text? I'd really appreciate your help on this. Link to comment https://forums.phpfreaks.com/topic/189840-operator-displays-text/ Share on other sites More sharing options...
Mchl Posted January 26, 2010 Share Posted January 26, 2010 What happens when you display the source of the page? Do you see whole PHP code? If yes, this means PHP is not running on your server. Link to comment https://forums.phpfreaks.com/topic/189840-operator-displays-text/#findComment-1001777 Share on other sites More sharing options...
magnoliazz Posted January 26, 2010 Author Share Posted January 26, 2010 well I'm using dreamweaver+easyphp, and everything seems ok, but when I preview php scripts in the browser I have this problem. How can I know if php works on the server or not? Link to comment https://forums.phpfreaks.com/topic/189840-operator-displays-text/#findComment-1001794 Share on other sites More sharing options...
Mchl Posted January 26, 2010 Share Posted January 26, 2010 Is this on your computer or on a webhost? Anyway: create this simple file; <?php phpinfo(); ?> If you see nothing, you've no PHP. Link to comment https://forums.phpfreaks.com/topic/189840-operator-displays-text/#findComment-1001815 Share on other sites More sharing options...
oni-kun Posted January 26, 2010 Share Posted January 26, 2010 Yes, I doubt you have PHP configured. Are you viewing the file directly via browser? Or are you doing localhost/to/file.php? "<?phpif( isset($_SESSION['ERRMSG_ARR']) && is_array($_SESSION['ERRMSG_ARR']) && count($_SESSION['ERRMSG_ARR'])>" The browser may see that all as one HTML tag (that does not exist, obviously. And only display the stuff after it, Another pointer that you're not running PHP! Link to comment https://forums.phpfreaks.com/topic/189840-operator-displays-text/#findComment-1001816 Share on other sites More sharing options...
magnoliazz Posted January 26, 2010 Author Share Posted January 26, 2010 I tried phpinfo() and it worked, but the problem is still the same. I tried reinstalling, still doesn't work wether I'm viewing the file directly with the browser or through "localhost/.../file.php". Link to comment https://forums.phpfreaks.com/topic/189840-operator-displays-text/#findComment-1001863 Share on other sites More sharing options...
Mchl Posted January 26, 2010 Share Posted January 26, 2010 Is the file saved with .php extension? Link to comment https://forums.phpfreaks.com/topic/189840-operator-displays-text/#findComment-1001866 Share on other sites More sharing options...
jl5501 Posted January 26, 2010 Share Posted January 26, 2010 One question, perhaps irrelevant, but you are viewing this file via http arent you? i.e. with a browser with http:// at the start? Link to comment https://forums.phpfreaks.com/topic/189840-operator-displays-text/#findComment-1001867 Share on other sites More sharing options...
magnoliazz Posted January 26, 2010 Author Share Posted January 26, 2010 yes the extension is .php and I'm viewing it with http. Also the httpd.config file seems to have all the entries necessary: ServerName localhost:80 LoadModule php5_module "C:/Program Files/EasyPHP5.3.0/php/php5apache2_2.dll" AddType application/x-httpd-php .php5 AddType application/x-httpd-php .php4 AddType application/x-httpd-php .php am I forgetting something? Link to comment https://forums.phpfreaks.com/topic/189840-operator-displays-text/#findComment-1001873 Share on other sites More sharing options...
akitchin Posted January 26, 2010 Share Posted January 26, 2010 are you sure there's no ? in there, right before the greater-than operator? if so, that would be a closing PHP tag, which would result in the output shown. Link to comment https://forums.phpfreaks.com/topic/189840-operator-displays-text/#findComment-1001938 Share on other sites More sharing options...
magnoliazz Posted January 26, 2010 Author Share Posted January 26, 2010 No, there's no ? before > , the code is as u can see it in the first post. Link to comment https://forums.phpfreaks.com/topic/189840-operator-displays-text/#findComment-1002021 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.