Author Topic: help...php in html  (Read 3512 times)

0 Members and 1 Guest are viewing this topic.

Offline disturbed

  • News Anchor
  • TMN Veteran
  • *
  • Posts: 2099
  • Karma: +1/-0
  • I am and always will be disturbed.
    • View Profile
help...php in html
« on: April 04, 2008, 03:30:32 PM »
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.
Are you down with the sickness !?

[ http://hackaday.com ]

Recommended Tests

Click here to run a free Performance Scan   TIP: Test how fast your system is really running
   Free Performance Scan
Click here to run a Free PC Error Scan    TIP: Test how many system errors your PC has
   Free PC Error Scan


Note: The links above are sponsored links

Online mudmanc4

  • Ɠξξ₭ òƒ Ɠξξ₭z
  • Global Moderator
  • TMN Seasoned Veteran
  • *
  • Posts: 6735
  • Karma: +8/-1
    • View Profile
    • The GG PV
Re: help...php in html
« Reply #1 on: April 04, 2008, 03:46:01 PM »
You need to enable error reporting and/or display errors in php.ini.


Offline disturbed

  • News Anchor
  • TMN Veteran
  • *
  • Posts: 2099
  • Karma: +1/-0
  • I am and always will be disturbed.
    • View Profile
Re: help...php in html
« Reply #2 on: April 04, 2008, 03:56:05 PM »
tried that....made a php.ini and put it in the same folder as my script....still the same outcome
Are you down with the sickness !?

[ http://hackaday.com ]

Online mudmanc4

  • Ɠξξ₭ òƒ Ɠξξ₭z
  • Global Moderator
  • TMN Seasoned Veteran
  • *
  • Posts: 6735
  • Karma: +8/-1
    • View Profile
    • The GG PV
Re: help...php in html
« Reply #3 on: April 04, 2008, 03:58:12 PM »
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?



Offline disturbed

  • News Anchor
  • TMN Veteran
  • *
  • Posts: 2099
  • Karma: +1/-0
  • I am and always will be disturbed.
    • View Profile
Re: help...php in html
« Reply #4 on: April 04, 2008, 04:04:33 PM »
I tried both the location where my .html file is that I am trying to run and now the cgi-bin as well.  Nothing.
Are you down with the sickness !?

[ http://hackaday.com ]

Online mudmanc4

  • Ɠξξ₭ òƒ Ɠξξ₭z
  • Global Moderator
  • TMN Seasoned Veteran
  • *
  • Posts: 6735
  • Karma: +8/-1
    • View Profile
    • The GG PV
Re: help...php in html
« Reply #5 on: April 04, 2008, 04:08:08 PM »
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?


Offline disturbed

  • News Anchor
  • TMN Veteran
  • *
  • Posts: 2099
  • Karma: +1/-0
  • I am and always will be disturbed.
    • View Profile
Re: help...php in html
« Reply #6 on: April 04, 2008, 04:12:10 PM »
Yes, I did both:
error_reporting(E_ALL);
ini_set('display_errors', '1');

No errors within the erorr log.  It's empty.
Are you down with the sickness !?

[ http://hackaday.com ]

Online mudmanc4

  • Ɠξξ₭ òƒ Ɠξξ₭z
  • Global Moderator
  • TMN Seasoned Veteran
  • *
  • Posts: 6735
  • Karma: +8/-1
    • View Profile
    • The GG PV
Re: help...php in html
« Reply #7 on: April 04, 2008, 04:20:21 PM »
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 ?



Offline disturbed

  • News Anchor
  • TMN Veteran
  • *
  • Posts: 2099
  • Karma: +1/-0
  • I am and always will be disturbed.
    • View Profile
Re: help...php in html
« Reply #8 on: April 04, 2008, 04:23:18 PM »
yes, 1 is on....

Wierd thing is...within html when I use the <?php ....

not even the print "something"; works

.......argh....
Are you down with the sickness !?

[ http://hackaday.com ]

Online mudmanc4

  • Ɠξξ₭ òƒ Ɠξξ₭z
  • Global Moderator
  • TMN Seasoned Veteran
  • *
  • Posts: 6735
  • Karma: +8/-1
    • View Profile
    • The GG PV
Re: help...php in html
« Reply #9 on: April 04, 2008, 04:31:33 PM »
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


Recommended Tests

Click here to run a free Performance Scan   TIP: Test how fast your system is really running
   Free Performance Scan
Click here to run a Free PC Error Scan    TIP: Test how many system errors your PC has
   Free PC Error Scan


Note: The links above are sponsored links

Offline disturbed

  • News Anchor
  • TMN Veteran
  • *
  • Posts: 2099
  • Karma: +1/-0
  • I am and always will be disturbed.
    • View Profile
Re: help...php in html
« Reply #10 on: April 04, 2008, 04:39:23 PM »
lol...everything is up and running
Are you down with the sickness !?

[ http://hackaday.com ]

Offline disturbed

  • News Anchor
  • TMN Veteran
  • *
  • Posts: 2099
  • Karma: +1/-0
  • I am and always will be disturbed.
    • View Profile
Re: help...php in html
« Reply #11 on: April 04, 2008, 04:39:47 PM »
.....i can echo and print all I want from within php scripts....just not html....
Are you down with the sickness !?

[ http://hackaday.com ]


Offline EBrown

  • Gaming Mod
  • TMN Friend
  • *
  • Posts: 465
  • Karma: +15/-2
  • Wanted, dead or alive.
    • View Profile
    • SkyQuest ORPG
Re: help...php in html
« Reply #12 on: April 04, 2008, 04:44:12 PM »
Modern Warfare 2 for Xbox 360:

92% of the teenage population has switched to rap. If you are in the 8% who ROCKS, copy & paste this in your signature
The artist formerly known as Nanobot.

Offline disturbed

  • News Anchor
  • TMN Veteran
  • *
  • Posts: 2099
  • Karma: +1/-0
  • I am and always will be disturbed.
    • View Profile
Re: help...php in html
« Reply #13 on: April 04, 2008, 04:59:35 PM »
Well, when I do that I get:

Premature end of script headers ERROR in the log.
Are you down with the sickness !?

[ http://hackaday.com ]

Offline EBrown

  • Gaming Mod
  • TMN Friend
  • *
  • Posts: 465
  • Karma: +15/-2
  • Wanted, dead or alive.
    • View Profile
    • SkyQuest ORPG
Re: help...php in html
« Reply #14 on: April 04, 2008, 05:02:24 PM »
Try:

<?php echo "test echo"; ?>

With all the edits the page said to do.
Modern Warfare 2 for Xbox 360:

92% of the teenage population has switched to rap. If you are in the 8% who ROCKS, copy & paste this in your signature
The artist formerly known as Nanobot.