Akshay123 Posted June 22, 2010 Share Posted June 22, 2010 I am pretty new to PHP, can you please help? Ok, thank you. One quick question: why is this not working? some usual html stuff is excluded, just look for the php part http://localhost/login.html Please Log In. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!-- usual header stuff goes here, excluded --> <!-- wrap starts here --> <div id="wrap"> <div id="header"> <div id="header-content"> <h1 id="site_heading"><a href="index.php" title="">Maahi<span class="gray">Network</span></a></h1> <h2 id="site_subheading"><span><!-- here comes the spaces --> By AKSHAY <!-- this php part works, keep reading --> <?php if (isset($_COOKIE["LOGIN"])){ include('/oauth/login/CookieHeaderHTML.php'); }else{ include('/oauth/login/NoCookieHeaderHTML.html'); } ?> <!-- Menu Tabs --> <!-- unimportant stuff excluded, basic html --> <!-- part that doesn't work below, shows up blank --> <!-- troublesome part --> <!-- below is where the login form http://localhost/oauth/login/login.php (mentioned before) is framed --> <!-- again, the '/oauth/login/login.php?error=incorrect' displays a special form with a error message --> <h1>Please Log In:</h1> <?php if(isset($_GET['ERROR'])){ echo "<html>"; echo "<iframe src ="/oauth/login/login.php?error=incorrect" width="35%" height="400" frameborder="no" scrolling="no">"; } else { echo "<html>"; echo "<iframe src ="/oauth/login/login.php?" width="35%" height="400" frameborder="no" scrolling="no">"; } ?> <!-- wierdly enough, anything after this iframe doesn't show up. it shows up on the browser html source code, but not on the page. --> <br><br><br> <!-- content-wrap ends here --> <!-- footer starts here --> <div id="footer"> <div id="footer-content"> <div id="footer-bottom"> <br> <p> <a href="/">Home</a> | <a href="/terms">Terms and Conditions</a> | <a href="/#top">Top</a> | <a href="/?mobileoveride=1">Switch to Mobile Version</a></p> <div id="copyright"> <p>© AKSHAY</p> </div> <div id="powered_by"><!-- This design is released under Creative Commons Attribution 2.5 License (http://creativecommons.org/licenses/by/2.5/) - Please leave the theme attribution intact --> <a href="http://vivi" style="text-decoration: none;"><img src="/assets/viviti/viviti_icon.png" alt="Powered by AKSHAY" style="margin-right: 2px; vertical-align: middle;" height="16" width="16"></a> ~ Designed by <a href="http://styleshout.com">styleshout.com</a> </div> </div> </div> </div> <!-- footer ends here --><!-- wrap ends here --> </body> </html> anyway, what happens when I go to "http://localhost/login.html?error=0", "http://localhost/login.html?error=1", "http://localhost/login.html?error=", and "http://localhost/login.html" is all the same. A empty spot is just there where the iframe is supposed to be. any help would be appreciated. thank you in advance... Link to comment https://forums.phpfreaks.com/topic/205514-php-will-not-display-please-help/ Share on other sites More sharing options...
Pikachu2000 Posted June 22, 2010 Share Posted June 22, 2010 You've tried to use unescaped double quotes in a double quoted string. You can either escape them, or change the enclosing quotes to single quotes. if(isset($_GET['ERROR'])){ echo "<html>"; echo "<iframe src ="/oauth/login/login.php?error=incorrect" width="35%" height="400" frameborder="no" scrolling="no">"; } Link to comment https://forums.phpfreaks.com/topic/205514-php-will-not-display-please-help/#findComment-1075563 Share on other sites More sharing options...
Akshay123 Posted June 22, 2010 Author Share Posted June 22, 2010 I don't understand, should I write the code like this, in single quotes? <?php if(isset($_GET['ERROR'])){ echo '<iframe src="/oauth/login/login.php?error=incorrect" width="35%" height="400" frameborder="no" scrolling="no">'; } else { echo '<iframe src="/oauth/login/login.php?" width="35%" height="400" frameborder="no" scrolling="no">'; } ?> when I use this code, the second iframe shows up, followed by a bunch of characters from the php code, like this '; } else { echo ' appearing in regular font Link to comment https://forums.phpfreaks.com/topic/205514-php-will-not-display-please-help/#findComment-1075582 Share on other sites More sharing options...
radar Posted June 22, 2010 Share Posted June 22, 2010 the reason those show up is probably because they are outside of a opening/closing php tag. Link to comment https://forums.phpfreaks.com/topic/205514-php-will-not-display-please-help/#findComment-1075629 Share on other sites More sharing options...
Pikachu2000 Posted June 22, 2010 Share Posted June 22, 2010 What you have above looks fine to me. It has to be something else causing the random characters. Please post the revised script within . . . BBcode tags. Link to comment https://forums.phpfreaks.com/topic/205514-php-will-not-display-please-help/#findComment-1075631 Share on other sites More sharing options...
seventheyejosh Posted June 22, 2010 Share Posted June 22, 2010 *.html (your login.html) files will not process php by default, you must enable it with AddType application/x-httpd-php .html in your .htaccess, or your apache configuration file. Link to comment https://forums.phpfreaks.com/topic/205514-php-will-not-display-please-help/#findComment-1075632 Share on other sites More sharing options...
Akshay123 Posted June 22, 2010 Author Share Posted June 22, 2010 oh, thank you, your solutions worked. however, if anyone can tell me why after the iframe, no code shows up, please do. Link to comment https://forums.phpfreaks.com/topic/205514-php-will-not-display-please-help/#findComment-1075653 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.