Thrice01 Posted June 18, 2006 Share Posted June 18, 2006 new here, hoping to use this forum more often though.ok so my website worked on localhost fine, v4.something. I transferred to my server which is running v5.1.3 and i noticed something.I have a bunch of if statements that determine what table gets displayed. Something like..<?phpif ($pagename == 'login.php') { ?> <table border="0" align="center"> <tr> <td>This gets displayer</td> </tr> </table><? } else { [i]do somethign else[/i]}?>Ok, that does not work at all. The only way i can get it to work is by echoing the table and placing slashes (\) infront of the quote marks. e.g.<?phpif ($pagename == 'login.php') { echo " <table border=\"0\" align=\"center\"> <tr> <td>This gets displayer</td> </tr> </table> "; } else { [i]do somethign else[/i]}?>Any explaintation why it won't let me code it the first way? im really not keen on echoing all my html data Quote Link to comment https://forums.phpfreaks.com/topic/12337-php-and-html-display-errors/ Share on other sites More sharing options...
trq Posted June 18, 2006 Share Posted June 18, 2006 What do you mean by doesn't work? Does it just display the html wether or not the if statement was satified? What? Quote Link to comment https://forums.phpfreaks.com/topic/12337-php-and-html-display-errors/#findComment-47135 Share on other sites More sharing options...
Thrice01 Posted June 18, 2006 Author Share Posted June 18, 2006 it displays nothing at all. A blank screen.IF i echo out the table, the table shows up fine. Quote Link to comment https://forums.phpfreaks.com/topic/12337-php-and-html-display-errors/#findComment-47139 Share on other sites More sharing options...
wildteen88 Posted June 19, 2006 Share Posted June 19, 2006 You have short opening PHP tag your server may not be configured to use <? as a opening php tag. So try this instead:[code]<?phpif ($pagename == 'login.php') { ?><table border="0" align="center"><tr><td>This gets displayer</td></tr></table><?php} else { //do somethign else}?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/12337-php-and-html-display-errors/#findComment-47239 Share on other sites More sharing options...
d_barszczak Posted June 19, 2006 Share Posted June 19, 2006 [!--quoteo(post=385453:date=Jun 19 2006, 12:09 AM:name=Thrice01)--][div class=\'quotetop\']QUOTE(Thrice01 @ Jun 19 2006, 12:09 AM) [snapback]385453[/snapback][/div][div class=\'quotemain\'][!--quotec--]new here, hoping to use this forum more often though.ok so my website worked on localhost fine, v4.something. I transferred to my server which is running v5.1.3 and i noticed something.I have a bunch of if statements that determine what table gets displayed. Something like..<?phpif ($pagename == 'login.php') { ?> <table border="0" align="center"> <tr> <td>This gets displayer</td> </tr> </table><? } else { [i]do somethign else[/i]}?>Ok, that does not work at all. The only way i can get it to work is by echoing the table and placing slashes (\) infront of the quote marks. e.g.<?phpif ($pagename == 'login.php') { echo " <table border=\"0\" align=\"center\"> <tr> <td>This gets displayer</td> </tr> </table> "; } else { [i]do somethign else[/i]}?>Any explaintation why it won't let me code it the first way? im really not keen on echoing all my html data[/quote]You cant use " when you user echo you must replace them with ' .ie.[code]<?phpif ($pagename == 'login.php') { echo (" <table border='0' align='center'> <tr> <td>This gets displayer</td> </tr> </table> "); } else { [i]do somethign else[/i]}?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/12337-php-and-html-display-errors/#findComment-47242 Share on other sites More sharing options...
Thrice01 Posted June 19, 2006 Author Share Posted June 19, 2006 [!--quoteo(post=385561:date=Jun 19 2006, 09:17 PM:name=wildteen88)--][div class=\'quotetop\']QUOTE(wildteen88 @ Jun 19 2006, 09:17 PM) [snapback]385561[/snapback][/div][div class=\'quotemain\'][!--quotec--]You have short opening PHP tag your server may not be configured to use <? as a opening php tag. So try this instead:[code]<?phpif ($pagename == 'login.php') { ?><table border="0" align="center"><tr><td>This gets displayer</td></tr></table><?php} else { //do somethign else}?>[/code][/quote]i replaced all <? in my code with <?php. Still doesn't work. When i ran the page, the php code was output as html text for some reason. It's like the page is not reading php at all, yet it works fine on another couple of pages.Any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/12337-php-and-html-display-errors/#findComment-47484 Share on other sites More sharing options...
trq Posted June 20, 2006 Share Posted June 20, 2006 Post you actual code. Quote Link to comment https://forums.phpfreaks.com/topic/12337-php-and-html-display-errors/#findComment-47507 Share on other sites More sharing options...
mainewoods Posted June 20, 2006 Share Posted June 20, 2006 Sound like your php parser is not running. Try creating the simplist possible page:[code]<?php echo "hello world";?>[/code]If that doen't work then your php parser is not working. Quote Link to comment https://forums.phpfreaks.com/topic/12337-php-and-html-display-errors/#findComment-47524 Share on other sites More sharing options...
Thrice01 Posted June 21, 2006 Author Share Posted June 21, 2006 [!--quoteo(post=385841:date=Jun 20 2006, 12:30 PM:name=thorpe)--][div class=\'quotetop\']QUOTE(thorpe @ Jun 20 2006, 12:30 PM) [snapback]385841[/snapback][/div][div class=\'quotemain\'][!--quotec--]Post you actual code.[/quote]can't, it's work related.[!--quoteo(post=385858:date=Jun 20 2006, 02:08 PM:name=mainewoods)--][div class=\'quotetop\']QUOTE(mainewoods @ Jun 20 2006, 02:08 PM) [snapback]385858[/snapback][/div][div class=\'quotemain\'][!--quotec--]Sound like your php parser is not running. Try creating the simplist possible page:[code]<?php echo "hello world";?>[/code]If that doen't work then your php parser is not working.[/quote]ill give that a shot when im back in the office. Quote Link to comment https://forums.phpfreaks.com/topic/12337-php-and-html-display-errors/#findComment-47865 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.