-4

Guys Im so frustrated with this and almost ready to give up on the whole thing.

I installed wamp server on win7 and all services running..I can browse to a php file on my web server and it works as expected but if I try to include it into my html it never runs and chromes dumb ass debugger never says anything is wrong here is an example of my html and php file which reside in the same directory..

file grrr.php

<?php echo "I HATE PHP" ;?>

file test.html

<!DOCTYPE HTML>
<HTML>
<Body>
<?php include 'grrr.php';?>
</Body>
</HTML>

Seems easy enough but nothing but a blank screen. although if i browse to grrr.php instead of test.html I get the expected output. What am I doing wrong...I have no hair left.

TotalNoob
  • 37
  • 8
  • 1
    change name of test.html to test.php. If it is .html server won't execute php for this – Ts8060 Jul 25 '18 at 05:40
  • frustration only comes from unsuspectingness. Grab yourself some books for html/js/php/css-basics and start from the beginning. Not just installing a server and thinking anything will be fine, duh. –  Jul 25 '18 at 06:11
  • @D.Schaller thanks for the advice...but I have been studing 3 different languages and didnt want to learn all of php to connect to sql...so I asked a question like you have in the past as well..so duh – TotalNoob Jul 25 '18 at 07:12
  • @TotalNoob "_Guys Im so frustrated with this and almost ready to give up on the whole thing._" ; "_[...]but I have been studing 3 different languages [...]_" - not very well I guess. –  Jul 25 '18 at 07:18

1 Answers1

3

There must be file with .php extension to use php code. As you are writing php code in .html file, it will prints the code as it is. So you should rename test.html to test.php

Lovepreet Singh
  • 4,792
  • 1
  • 18
  • 36
  • Thank you that worked maybe I can figure out now how to finally query my sql db..thanks again..but may be posting question soon lol – TotalNoob Jul 25 '18 at 06:10