shams Posted March 27, 2006 Share Posted March 27, 2006 hi,as i read from manual all of these codes should work:<html><head> <title>PHP Test</title></head><body><?php echo 'This is a test';?><?php echo 'This is a test' ?><?php echo 'We omitted the last closing tag';</body></html>but it doesn't worked for me unless i complette all the missing tags and semi colons, any idea please? Quote Link to comment https://forums.phpfreaks.com/topic/5898-php-code-doesnt-work/ Share on other sites More sharing options...
micah1701 Posted March 27, 2006 Share Posted March 27, 2006 i'm not sure what the problem is?its not supposed to work if you don't use the right colans and closing tags.if you leave them out, PHP can't parse your code and can't display the page. so make sure you put the semi colans in the right place and remember to close your tags. Quote Link to comment https://forums.phpfreaks.com/topic/5898-php-code-doesnt-work/#findComment-21065 Share on other sites More sharing options...
Guest footballkid4 Posted March 27, 2006 Share Posted March 27, 2006 1) Next time, please choose a topic that is somewhat relevant to the content of the post, such as "PHP code not evaluated". That title would tell us that your code isn't being processed at all...where as saying it just doesn't work can mean a lot of things.2) Are you able to get any content from PHP displayed on a page? If yes, then the problem you're looking at is the incorrect use of [b]syntax[/b]. PHP requires correct syntax so it can parse your code and find where one line ends and the next begins. If you can't get any data to display, please create a topic in the "PHP Installation" forum with more details about your server. Quote Link to comment https://forums.phpfreaks.com/topic/5898-php-code-doesnt-work/#findComment-21084 Share on other sites More sharing options...
wildteen88 Posted March 27, 2006 Share Posted March 27, 2006 Your code is working it is because of your last PHP statement:[code]<?php echo 'We omitted the last closing tag';</body></html>[/code]You haven't ended your PHP statement properly and I dont know here you have heard that from about PHP not needing a closing PHP statement tag (?>) as PHP needs this in order to know here each code block ends, as currently PHP is returning the following error:[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]Parse error: syntax error, unexpected '<' in {path/of/file/here/filename.php} on line 13[/quote]You dont see this message as your server may have display_errors turned off in your php.ini file and so you get a blank page. I would recommend you to turn on display_errors this will help understand why your scripts aren't working if an error occurs.The other two PHP statements are valid. However dont use the the secound PHP statement too much make sure you do allways end you lines of code with a semi-colon. So in order to get your script to work just delete this: [i]<?php echo 'We omitted the last closing tag';[/i] from your script. Quote Link to comment https://forums.phpfreaks.com/topic/5898-php-code-doesnt-work/#findComment-21134 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.