disturbed Posted April 4, 2008 CID Share Posted April 4, 2008 I'm just now learning some php. I'm getting some basic ideas of how it works and its going well...but I just cannot figure out why echo-ing php in html doesn't work.... If I have a php file with this contents: echo "test echo"; $blah="display blah"; echo $blah; and I run the file, it works great. However, if I put in the same code inline with html code by: <?php echo "test echo"; $blah="display blah"; echo $blah; ?> ....nothing. Empty. Nothing gets displayed. Why is this? Also, because of this I cannot figure out how to use variables from php in html...same issue I believe. Quote Link to comment Share on other sites More sharing options...
mudmanc4 Posted April 4, 2008 CID Share Posted April 4, 2008 You need to enable error reporting and/or display errors in php.ini. Quote Link to comment Share on other sites More sharing options...
disturbed Posted April 4, 2008 Author CID Share Posted April 4, 2008 tried that....made a php.ini and put it in the same folder as my script....still the same outcome Quote Link to comment Share on other sites More sharing options...
mudmanc4 Posted April 4, 2008 CID Share Posted April 4, 2008 tried that....made a php.ini and put it in the same folder as my script....still the same outcome Create a php.ini in your cgi-bin directory right? Quote Link to comment Share on other sites More sharing options...
disturbed Posted April 4, 2008 Author CID Share Posted April 4, 2008 I tried both the location where my .html file is that I am trying to run and now the cgi-bin as well. Nothing. Quote Link to comment Share on other sites More sharing options...
mudmanc4 Posted April 4, 2008 CID Share Posted April 4, 2008 Do you have " display_errors " turned on? Since it is a syntax error , nothing will execute there fore no errors, did you check the logfile? Quote Link to comment Share on other sites More sharing options...
disturbed Posted April 4, 2008 Author CID Share Posted April 4, 2008 Yes, I did both: error_reporting(E_ALL); ini_set('display_errors', '1'); No errors within the erorr log. It's empty. Quote Link to comment Share on other sites More sharing options...
mudmanc4 Posted April 4, 2008 CID Share Posted April 4, 2008 Yes, I did both: error_reporting(E_ALL); ini_set('display_errors', '1'); No errors within the erorr log. It's empty. Shouldn't the ini_set('display_errors', '1'); look like ini_set('display_errors', 'on' " , or does "1" represent on ? Quote Link to comment Share on other sites More sharing options...
disturbed Posted April 4, 2008 Author CID Share Posted April 4, 2008 yes, 1 is on.... Wierd thing is...within html when I use the <?php .... not even the print "something"; works .......argh.... Quote Link to comment Share on other sites More sharing options...
mudmanc4 Posted April 4, 2008 CID Share Posted April 4, 2008 yes, 1 is on.... Wierd thing is...within html when I use the <?php .... not even the print "something"; works .......argh.... Is apache running? hahahaa Quote Link to comment Share on other sites More sharing options...
disturbed Posted April 4, 2008 Author CID Share Posted April 4, 2008 lol...everything is up and running Quote Link to comment Share on other sites More sharing options...
disturbed Posted April 4, 2008 Author CID Share Posted April 4, 2008 .....i can echo and print all I want from within php scripts....just not html.... Quote Link to comment Share on other sites More sharing options...
nanobot Posted April 4, 2008 CID Share Posted April 4, 2008 See if this helps: http://www.desilva.biz/php/phpinhtml.html Quote Link to comment Share on other sites More sharing options...
disturbed Posted April 4, 2008 Author CID Share Posted April 4, 2008 Well, when I do that I get: Premature end of script headers ERROR in the log. Quote Link to comment Share on other sites More sharing options...
nanobot Posted April 5, 2008 CID Share Posted April 5, 2008 Try: <?php echo "test echo"; ?> With all the edits the page said to do. Quote Link to comment Share on other sites More sharing options...
disturbed Posted April 5, 2008 Author CID Share Posted April 5, 2008 I tried it.....still getting the same error. Quote Link to comment Share on other sites More sharing options...
nanobot Posted April 5, 2008 CID Share Posted April 5, 2008 I tried it.....still getting the same error. So you have your server set up correcttly, right? Can you give me the software it uses or do you not know? Quote Link to comment Share on other sites More sharing options...
disturbed Posted April 5, 2008 Author CID Share Posted April 5, 2008 Im on a shared hosting plan. Everything seems to be working but that...grrrrr Quote Link to comment Share on other sites More sharing options...
dlewis23 Posted April 5, 2008 CID Share Posted April 5, 2008 What version of php & apache are you running? Quote Link to comment Share on other sites More sharing options...
disturbed Posted April 5, 2008 Author CID Share Posted April 5, 2008 I believe 1.3.39 for apache and 4.4.4 for php although on the forums I noticed that the host said all shared are being moved to php 5 Quote Link to comment Share on other sites More sharing options...
dlewis23 Posted April 5, 2008 CID Share Posted April 5, 2008 I believe 1.3.39 for apache and 4.4.4 for php although on the forums I noticed that the host said all shared are being moved to php 5 They should have moved to 5 a while ago. Who is your host? If you put this in a info.php page it works right? <?php phpinfo(); ?> 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.
Note: Your post will require moderator approval before it will be visible.